Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: select and IO::Handle

by danger (Priest)
on Aug 04, 2001 at 01:21 UTC ( #102168=note: print w/ replies, xml ) Need Help??


in reply to select and IO::Handle

I found that using either of the tied interfaces worked as you expect (both documented in the POD's for Perl-5.004 or later):

#!/usr/bin/perl -w use strict; use IO::Scalar; my $string; tie *OUT, 'IO::Scalar', \$string; select OUT; print "line 1\nline 2\n", "line 3\n"; select STDOUT; print "The string contains:\n$string\n"; ### OR this way: $string = ''; my $SH = IO::Scalar->new_tie(\$string); $SH->print("line 1\n"); # use the OO method print $SH "line 2\n"; # use it like a filehandle select $SH; # select it as default output handle print "line 3\n"; select STDOUT; print "The string contains:\n$string" __END__


Comment on Re: select and IO::Handle
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2014-07-30 00:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls