Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Still blurry on variables for filehandles

by Errto (Vicar)
on Jan 24, 2007 at 16:34 UTC ( [id://596279]=note: print w/replies, xml ) Need Help??


in reply to Still blurry on variables for filehandles

The issue comes from assigning $foo to the string 'FILE'. As others have mentioned, you can call open on an undefined scalar lvalue and it will magically assign a filehandle to it. If you are so inclined, you can also do it explicitly yourself:
use IO::File; my $foo = new IO::Handle; open $foo, '<', 'data.txt';
Update: switched modules per ikegami's suggestion.

Replies are listed 'Best First'.
Re^2: Still blurry on variables for filehandles
by ikegami (Patriarch) on Jan 24, 2007 at 17:12 UTC
    I'd use IO::File over FileHandle. FileHandle is a backwards compatibility wrapper for IO::File.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-19 06:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found