sub two_pass { my @matched; open (my $FH, "<$file"); while (my $rec = <$FH>) { if ( $rec =~ '500_000' ) { push @matched, $rec; } if ( $rec =~ '500_001' ) { push @matched, $rec; } } print "two pass: " . @matched; close $FH; } #### c:\test>junk31 836952.log Benchmark: timing 1 iterations of AAtwo_pass, BBtwo_string, CCone_string ... two pass: 10 AAtwo_pass: 6 wallclock secs ( 5.69 usr + 0.78 sys = 6.47 CPU) @ 0.15/s (n=1) (warning: too few iterations for a reliable count) two string: 10 BBtwo_string: 15 wallclock secs (14.34 usr + 0.73 sys = 15.07 CPU) @ 0.07/s (n=1) (warning: too few iterations for a reliable count) one string: 7 CCone_string: 15 wallclock secs (14.76 usr + 0.76 sys = 15.52 CPU) @ 0.06/s (n=1) (warning: too few iterations for a reliable count) #### c:\test>\perl32\bin\perl junk31.pl 836952.log Benchmark: timing 1 iterations of AAtwo_pass, BBtwo_string, CCone_string ... two pass: 10 AAtwo_pass: 8 wallclock secs ( 6.60 usr + 0.69 sys = 7.29 CPU) @ 0.14/s (n=1) (warning: too few iterations for a reliable count) two string: 10 BBtwo_string: 53 wallclock secs (52.99 usr + 0.70 sys = 53.70 CPU) @ 0.02/s (n=1) (warning: too few iterations for a reliable count) one string: 7 CCone_string: 7 wallclock secs ( 5.60 usr + 0.92 sys = 6.52 CPU) @ 0.15/s (n=1) (warning: too few iterations for a reliable count)