in reply to Re: reading files from a directory
in thread reading files from a directory

Thank you. Are you saying that IN is better than $fh?

Replies are listed 'Best First'.
Re^3: reading files from a directory
by johngg (Canon) on Oct 28, 2010 at 08:42 UTC

    The recommendation these days is to use the three argument form of open, lexical filehandles rather than package filehandles (i.e. $fh rather then IN) and to check for the success of the operation, showing the O/S error ($!) in the error message on failure.

    ... my $inputFile = q{/path/to/myFile; open my $inputFH, q{<}, $inputFile or die qq{open: < $inputFile: $!\n}; ...

    I hope this is helpful.

    Cheers,

    JohnGG