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