in reply to Reading from a file

1. Is it really necessary to re-read the whole file each time? Does the file actually change that much or is it just appended to? If the latter see also File::Tail.

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;