in reply to Reading from a file
2. I'm guessing here, but you probably want more than one line out of the file, right? Try something like:
open IN,"<",$fileName or die "Can't open $filename: $!"; while (<IN>) { # read line from IN handle to $_ if ($. == $some_number || $. == $some_other_number) { # $. is the c +urrent line number # do stuff with the line in $_ } last if $. > $last_interesting_line_number; } close IN;
|
|---|