in reply to possible bug in opening file handle to variable
My first thought was: what would happen if the scalar ref is used as 'filename' twice?
So I tried this code:
my $x = ""; { local *STDOUT; local *STDERR; open STDOUT, ">>", \$x; open STDERR, ">>", \$x; print "OUT-1\n"; print STDERR "ERR-1\n"; print "OUT-2\n"; } print $x;
And the output of this is: OUT-1 ERR-1 OUT-2... is this what you want?
(Note, this was run on v5.8.3)
|
|---|