in reply to Re: how to prevent open from dying
in thread how to prevent open from dying

Don't forget to limit the scope of your file handles .. or just use lexicals:

while ( ... ) { open my $fh, '<', $inputFile or warn( "Unable to open analysis file $inputFile: $!\n" ); next unless defined $fh ... }

-derby

Replies are listed 'Best First'.
Re^3: how to prevent open from dying
by ikegami (Patriarch) on Jun 30, 2006 at 19:46 UTC
    I hate testing for the same condition twice in a row, as you did.
    while ( ... ) { my $fh; if (!open($fh, '<', $inputFile)) { warn( "Unable to open analysis file $inputFile: $!\n" ); next; } ... }