perl -pe 'if(/\[Section (\w)\]/){if($1 eq 'B'){$f=1;}else{$f=0if($f);}};s/^\$param2=value2$/\$param2=new_value2/ if($f);'