Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: valid filehandle

by jsprat (Curate)
on Mar 20, 2003 at 23:47 UTC ( #244766=note: print w/ replies, xml ) Need Help??


in reply to valid filehandle

Update: You do realize 1: this code opens the file for read, not write and 2: If the file open is successful the else clause will be executed?

Sure - the filetests (-f in this case) work on filehandles as well as filenames.

if (-f $test) { print $test "It's a file"; }

See perldoc perlfunc(search for -X) for more info on all the filetest operators.


Comment on Re: valid filehandle
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (21)
As of 2015-07-02 18:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (44 votes), past polls