in reply to newbie questions on array access and control loops

Well from the looks of it, and if I understand your question, you want to print all the lines in the file that matched your regular expression. Try this:
#!/apps/bin/perl -w use strict; my @lines_that_matched = (); while (<>) { chomp; if (/PAGE: 2/) { push (@lines_that_matched, $_); } } foreach my $line (@lines_that_matched) { print "$line\n"; }
So if the current line being read has a successful match of the regex, add it to the array of matched lines. After you have read thru the entire file, print each line that matched.