open FILE, "<$file" or "Oops Perl says $!\n"; @file = ; close FILE; print @file[22..55]; # or without glbbing in the whole file $. has line number we are at open FILE, "<$file" or "Oops Perl says $!\n"; while() { next if $. < 23; last if $. > 56; print; } close FILE;