in reply to Re: Capturing the first and last line of a file ?
in thread Capturing the first and last line of a file ?

Here is another way of doing the same thing but without modifying the file.
tie @array, 'Tie::File', $fname or die "Can't tie $fname: $!"; my ($first,$last) = @array[0,$#array]; untie @array;