in reply to Re^4: file handling
in thread file handling

That needs to be
while ( defined( my $line = $fh->getline ) ) {

defined is automatically added in some cases. That's not one of them.