in reply to Re: Reading Lines from Text file
in thread Reading Lines from Text file

Or, if you don't mind a little less portability in order to do one less sub-shell invocation:
my ( $first, $last ) = `head -1 $filename && tail -1 $filename`;