in reply to Printing specific line numbers

Use $. to determine the current file line number. I don't do command line, but the following should point you in the right direction:

use strict; use warnings; my $tempFileName = 'temp.txt'; open tempFile, '>', $tempFileName; print tempFile <<TEMP; Line one Line two Line three Line four Line five TEMP close tempFile; open tempFile, '<', $tempFileName; while (<tempFile>) { print "$_" if $. >= 2 && $. <= 4; } close tempFile;

Prints:

Line two Line three Line four

DWIM is Perl's answer to Gödel