Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: How to tie a lexical filehandle. (updated x2)

by haukex (Archbishop)
on Jun 20, 2017 at 19:44 UTC ( [id://1193172]=note: print w/replies, xml ) Need Help??


in reply to How to tie a lexical filehandle.

use IO::Handle; my $fh = IO::Handle->new; tie *$fh, ...;

Update: Or the following slightly more low-level way, the relevant code of IO::Handle->new doesn't do a whole lot more than this:

use Symbol qw/gensym/; my $fh = gensym; tie *$fh, ...;

Links: IO::Handle, Symbol.

Update 2017-09-30: One more, from here:

my $fh = \do { local *HANDLE };

Replies are listed 'Best First'.
Re^2: How to tie a lexical filehandle.
by clueless newbie (Curate) on Jun 20, 2017 at 21:31 UTC
    Thanks!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2024-04-18 09:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found