Like this?
#! perl -slw use strict; my $data = do{ local $/; <DATA> }; $data =~ s[(if.*?{)]{ ( my $subscope = $1 ) =~ s[\n][]g; $subscope; }smge; print $data; __END__ if (@Agent eq 'XX') { @Agent='{XX}' } if ( @Agent eq 'XX' ) { @Agent='{XX}' }
Prints
C:\test>junk7 if (@Agent eq 'XX'){ @Agent='{XX}' } if ( @Agent eq 'XX') { @Agent='{XX}' }
In reply to Re: Search and Replace Within Subscopes
by BrowserUk
in thread Search and Replace Within Subscopes
by DanielNeedles
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |