Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: reading files from a directory

by kevyt (Scribe)
on Oct 28, 2010 at 05:50 UTC ( [id://867912]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://867912]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-03-28 21:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found