Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

RE: Localizing Filehandles

by ahunter (Monk)
on Jul 14, 2000 at 14:38 UTC ( #22530=note: print w/ replies, xml ) Need Help??


in reply to Localizing Filehandles

...unless you're using Perl 5.6, in which case:

open my $fh, "<foo.txt";
and similar now work (apparently, I've never tried it). And of course, there's always IO::Handle & friends.

Andrew.


Comment on RE: Localizing Filehandles
Download Code
RE: RE: Localizing Filehandles
by Adam (Vicar) on Jul 14, 2000 at 21:11 UTC
    Yes. Additionally you can use the FileHandle module:
    use FileHandle; sub Whatever { my $filehandle = new FileHandle; open $filehandle, $file or die "Failed to open $file, $!"; # do stuff. close $filehandle or die "Failed to close $file, $!"; }
    But that wasn't my point.
      I was going to add "which only goes to show that by posting here you find out several other ways to do the same thing", but it seems I forgot.

      Andrew.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-10-21 01:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (95 votes), past polls