in reply to Loops and Pattern Matching

From the perlsyn documentation:
<cite>If any element of LIST is an lvalue, you can modify it by modifying VAR inside the loop. Conversely, if any element of LIST is NOT an lvalue, any attempt to modify that element will fail. In other words, the "foreach" loop index variable is an implicit alias for each item in the list that you're looping over. </cite>

So $line isn't a copy of the line from @LOOP: it actually is that line.

foreach (@LOOP) { my $line=$_; # Don't want to modify the orginal! $line =~ s/FNAME/$record/; $line =~ s/BANNER/@BAN/; print $line; }
ought to do what you want.