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

Re: Re: why don't filehandles have punctuation before their name?

by chipmunk (Parson)
on Apr 24, 2001 at 08:21 UTC ( [id://74956]=note: print w/replies, xml ) Need Help??


in reply to Re: why don't filehandles have punctuation before their name?
in thread why don't filehandles have punctuation before their name?

Actually, filehandles (and dirhandles) are not just scalars. In fact, if you look at the value returned by new FileHandle, you will see that it is a reference to a GLOB.

Because filehandles (and dirhandles) don't have a special syntax, like scalars/arrays/hashes, you have to refer to the entire glob instead. This is why you see code like:

sub myprint { my($fh) = @_; print $fh "Hello world.\n"; } myprint \*STDOUT;
The FileHandle and IO::Handle modules make it more convenient to use arbitrary handles, because they hide the reference-to-glob syntax.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-25 15:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found