in reply to Re: String Buffer
in thread String Buffer
Or, without using tie:
open my $oldout, ">&STDOUT" or die "Can't dup STDOUT: $!"; my $stdout; close STDOUT; open STDOUT, ">", \$stdout or die $!; # This is where the magic happen +s print "foo\n"; close STDOUT; open STDOUT, ">&", $oldout or die $!; print "Done fooling around\n"; print $stdout; # foo
This is mostly copy & pasted from open, so you might want to look there for more.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: String Buffer
by ambrus (Abbot) on Aug 25, 2008 at 13:07 UTC |