use Time::HiRes qw(gettimeofday tv_interval); my $bigfile = shift or die "Big file?"; sub openandreadbigfile { open my $fh, "<:raw", $bigfile or die $!; local $/; my $xxx = <$fh>; undef; } while () { my $t0 = [gettimeofday]; openandreadbigfile(); my $elapsed = tv_interval($t0); warn $elapsed, "\n"; }