my $file = shift @ARGV; my ($fh, $time); my $filesize = -s $file; sysopen($fh, $file, 0) or die "\nCant open file!\n"; # Open file for reading only $time = time; my $bytes_read = sysread($fh, my $buffer, $filesize); # Read the whole file into $buffer close $fh; defined $bytes_read && $bytes_read == $filesize or die "\nCouldnt read the whole file!\n"; # Do your query thing here # and see how much faster it is! printf "%f read lines from disk and do RE.\n", time - $time;