perl -e "$first = <>; while($line = <>) { $last = $line; }; print 'first : ', $first, 'last : ', $last;" filename