in reply to Loops and Pattern Matching

Firstly, use strict. Use warnings. It's possible that your error could be related to that. (The other posters do have very good points, too.)

Secondly, your logic seems to be a little sketchy. You're doing the operations on @LOOP several times, once for each file. But, you never reset @LOOP. It's not a pattern-matching problem, but a logic issue. Instead, consider:

foreach my $record (@BLIST) { open(BAN, $record) or &Error($!); my @BAN = <BAN>; close BAN; my @tempLOOP = @LOOP; foreach my $line (@tempLOOP) { $line =~ s/FNAME/$record/; $line =~ s/BANNER/@BAN/; print $line; } }

In addition, I would highly reccomend using the HTML templating modules that have already been written, vs. rolling your own. (That is what you're doing, right?)

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.