On 5/7/07, Karyn Williams <[EMAIL PROTECTED]> wrote:

I have this script I have been working on where I need to redirect STDOUT
and STDERR to files at the beginning of the script and then back to default
(terminal) at the end of the script. I found an example on-line and used it
and it works, however it generates a warning when running my script. I

Name "main::OLDOUT" used only once: possible typo at ./match.pl line 37.

open (OLDOUT, ">&STDOUT");

You could declare your bareword filehandles. Adding a line like this
should work.

   our($OLDOUT, $OLDERR);  # "declare" OLDOUT and OLDERR

But the easiest way to solve this is probably to use ordinary
variables instead of your bareword filehandles:

   open(my $oldout, ">&STDOUT") or die "Can't reopen STDOUT: $!";

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to