#!/usr/bin/perl use warnings; use strict; my $start = 2; my $end = 4; while (<>) { ($. == $start)..($. == $end) and print "$.: $_"; }