in reply to Tieing a local filehandle

If your on 5.8.1 (from memory), you can skip using IO::Scalar completely and using teh new form of open to a scalar (which means $/ is honoured correctly).

#! perl -slw use strict; my $x; { local *STDERR; open STDERR, '>', \$x or die "STDERR $!"; print STDERR 'stuff'; warn 'Sommats up!'; } print STDERR 'More stuff'; print "Caught: $x"; __END__ P:\test>381308 More stuff Caught: stuff Sommats up! at P:\test\381308.pl line 9.

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

Replies are listed 'Best First'.
Re^2: Tieing a local filehandle
by etcshadow (Priest) on Aug 09, 2004 at 18:15 UTC
    Yes, that is cool, and I did know about that. I should have mentioned that I'm on 5.005_03.

    Thanks, though.

    ------------ :Wq Not an editor command: Wq