in reply to Capturing the first and last line of a file ?
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
|
---|