in reply to Print some lines in a range

1. To stop it from running : Cltr C

2. Another Method:

Steps:

a. Since the file is large, read each line of the file using while loop. Don't insert the entire file in an array.

b. Then, use count to keep track of each line of the file and store the line using push. In this case, you need to know which lines you to print/have in an array (or any data structure depending upon your later operations)

or use regular expressions to extract the line you want or the one you want to discard.

Example Code: Insert the Lines using regular expression

print "Enter the file name: "; chomp( $filename = <STDIN> ); open my $INPUT, $filename or die $!; my $count = 0; while(<$INPUT>){ $count++; if ( $_ =~ <pattern> ){ push(@lineCases,$_); } }