Skip to content

Instantly share code, notes, and snippets.

@reneeb
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reneeb/8842073 to your computer and use it in GitHub Desktop.
Save reneeb/8842073 to your computer and use it in GitHub Desktop.
reneeb@perl-services:~/community$ perl -E ' open $wfh, ">", "large_file.txt"; say $wfh $_ for 0 .. 1_000_000; close $wfh; open my $fh, "<","large_file.txt"; my $line; for ( ;<$fh>; ) { $line = $. } say $.; <STDIN>'
1000001
=> 18083 reneeb 20 0 29924 3952 1972 S 0,0 0,1 0:00.50 perl
reneeb@perl-services:~/community$ perl -E ' open $wfh, ">", "large_file.txt"; say $wfh $_ for 0 .. 1_000_000; close $wfh; open my $fh, "<","large_file.txt"; my $line; for ( <$fh> ) { $line = $. } say $.; <STDIN>'
1000001
=> 18101 reneeb 20 0 174m 148m 1988 S 0,0 1,9 0:00.70 perl
reneeb@perl-services:~/community$ perl -E ' open $wfh, ">", "large_file.txt"; say $wfh $_ for 0 .. 1_000_000; close $wfh; open my $fh, "<","large_file.txt"; my $line; while ( <$fh> ) { $line = $. } say $.; <STDIN>'
1000001
=> 18107 reneeb 20 0 29924 3952 1972 S 0,0 0,1 0:00.52 perl
reneeb@perl-services:~/community$ perl -E ' open $wfh, ">", "large_file.txt"; say $wfh $_ for 0 .. 1_000_000; close $wfh; open my $fh, "<","large_file.txt"; my $line; foreach ( <$fh> ) { $line = $. } say $.; <STDIN>'
1000001
=> 18109 reneeb 20 0 174m 148m 1988 S 0,0 1,9 0:00.68 perl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment