There is a lot of copying but no more than one line is stored in memory.use strict; open (FOO, "test") || die "ERROR Unable to open test: $!\n"; my $first = <FOO>; my $last = $first; while (<FOO>) {$last = $_} close FOO; print "$first\n$last\n";
--
flounder
In reply to Re: Capturing the first and last line of a file ?
by flounder99
in thread Capturing the first and last line of a file ?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |