casiano has asked for the wisdom of the Perl Monks concerning the following question:
I need to write some recursive subroutine that in each entry has to
but I need to use lexical variables $SAVEOUT, and $SAVEERR instead of global variables. The problem being that to recover the old values I have now:my $log = ...; my $err = ...; open(SAVEOUT, ">&STDOUT") or die ... open(STDOUT,"> $log") or die .. open(SAVEERR, ">&STDERR") or die ... open(STDERR,"> $err") or die ..
open(STDOUT, ">&SAVEOUT"); open(STDERR, ">&SAVEERR");
I assume that this construction will not work If I use it with lexical variables? i.e.
open(STDOUT, ">&$SAVEOUT"); open(STDERR, ">&$SAVEERR");
How can I do it?
Thanks!
Casiano
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Recursively changing STDOUT
by shmem (Chancellor) on Sep 16, 2007 at 13:13 UTC | |
|
Re: Recursively changing STDOUT
by Sidhekin (Priest) on Sep 16, 2007 at 12:30 UTC | |
|
Re: Recursively changing STDOUT
by moritz (Cardinal) on Sep 16, 2007 at 12:22 UTC | |
by casiano (Pilgrim) on Sep 16, 2007 at 12:32 UTC |