#! perl -slw use strict; use Benchmark::Timer; my $T = new Benchmark::Timer; $T->start('read'); open IN, '<', $ARGV[ 0 ] or die $!; my $text; sysread IN, $text, -s( $ARGV[ 0 ] ) or die $!; $T->stop('read'); printf "file contains %d bytes\n", length $text; my $count = 0; $T->start('regex'); $count++ while $text =~ m[(12345)]g; $T->stop('regex'); print "$count matches found"; $T->report; __END__ C:\test>junk junk.dat file contains 213909504 bytes 2016 matches found 1 trial of read (452.624ms total) 1 trial of regex (260.872ms total)