http://www.perlmonks.org?node_id=987294


in reply to Printing first and last line

perl -ne 'print if eof || $. == 1' my_file