#! perl -slw use strict; use Time::HiRes qw[ time ]; sub slurp { local( $/, @ARGV ) = ( -s( $_[0] ), $_[0] ); <>; } my $start = time; my $user = $ARGV[0] or die 'No user supplied'; my @matches; my $files = 0; while( glob 'hist/*.htm' ) { $files++; my $file = slurp $_; push @matches, $_ if $file =~ m[ Comment\s+\d+
\n \Q$user\E ]mx; } printf "Searched $files files in %g seconds\n", time() - $start; die "No match found for user $user" unless @matches; print "User $user found in files:\n", join "\n", @matches; __END__ P:\test>522029 Buk Searched 133 files in 0.0694289 seconds No match found for user Buk at P:\test\522029.pl line 26, <> line 133. P:\test>522029 Doug Searched 133 files in 0.069006 seconds User Doug found in files: hist/h0511.htm hist/h0601.htm P:\test>522029 "J H" Searched 133 files in 0.0696189 seconds User J H found in files: hist/h0511.htm hist/h0601.htm