foreach $File (@File) { $File =~ s/\n//; foreach $Field (@InputFields) { $ReplaceVar = $FORM($Field); $ReplaceVar2 = ''; $SearchVar = '\[' . Field . '\]'; $SearchVar2 = '\['.*'\]'; $File =~ s/$SearchVar/$ReplaceVar/g; $File =~ s/$SearchVar2/$ReplaceVar2/g; } print "$File\n"; }
Can I run a search and replace on a line, then run a second one consecutively to catch the ones that weren't replaced. Doesn't seem to work for me? Why not?
In reply to Re: Pattern Match and Replace Problem
by belize
in thread Pattern Match and Replace Problem
by belize
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |