in reply to How does the while works in case of Filehandle when reading a gigantic file in Perl
You can check this yourself with the following untested code:
Now you have the time for the 'while' loop with and without your 'do something' actual code.use strict; use warnings; use Time:HiRes qw( gettimeofday ); open ( my $fh, "<", "./something.txt" || die "! open $!\n"; my $stime = gettimeofday; while (<$fh>) { } print gettimeofday - $stime, "\n"; close $fh; open ( $fh, "<", ".something.txt" || die "! open $!\n"; $stime = gettimeofday; while (<$fh>) { # do something is your actual code! } print gettimeofday - $stime, "\n"; close $fh;
I suspect your experiential growth is something your doing in the 'do something' part of the script. Post it and we may help improve the process.
Regards...Ed
"Well done is better than well said." - Benjamin Franklin
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How does the while works in case of Filehandle when reading a gigantic file in Perl
by raj4489 (Acolyte) on Feb 06, 2015 at 12:39 UTC | |
by Corion (Patriarch) on Feb 06, 2015 at 12:43 UTC |