in reply to Re: Solving Deep recursion with a tied Filehandle
in thread Solving Deep recursion with a tied Filehandle

If you don't want it to localize STDOUT, the following works:
{ local *TEMP = *STDOUT; undef(*STDOUT); tie *STDOUT, 'FileHandle::A', *TEMP; } print "testing";
and so does
{ my $temp = *STDOUT; undef(*STDOUT); tie *STDOUT, 'FileHandle::A', $temp; } print "testing";

Tested on Perl 5.6.1 and 5.8.0

Replies are listed 'Best First'.
Re^3: Solving Deep recursion with a tied Filehandle
by cog (Parson) on Oct 15, 2005 at 18:03 UTC
    None of those work with my 5.8.7
      How about
      { local *TEMP; open(TEMP, ">&STDOUT") or die("Unable to dup STDOUT: $!\n"); undef(*STDOUT); tie *STDOUT, 'FileHandle::A', *TEMP; } print "testing";
        Nope :-\ Same thing :-\