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

Re^2: Using the contents of

by ikegami (Pope)
on Sep 22, 2008 at 19:56 UTC ( #713085=note: print w/ replies, xml ) Need Help??


in reply to Re: Using the contents of
in thread Using the contents of

Don't use tie. Since 5.8.0, you can create a file handle that reads from/writes to a scalar.

my $data = '...'; open(my $fh, '<', \$data) or die; sub_that_needs_file_handle($fh);

Before 5.8, IO::Scalar and IO::String provide the functionality (although not as well) by using tie

Neither tie nor this method produce a real (system) file handle, so they won't work where a real file handle is needed. For example, you can't use them to capture the output of a child process. (See IPC::Run for a solution in that particular case.)


Comment on Re^2: Using the contents of
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2015-07-06 22:44 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 (84 votes), past polls