Temporarily redirecting STDERR

Todd Caine todd_caine at eli.net
Tue Apr 16 10:28:22 CDT 2002


Well one way to do it would be:

open FILE, "> $file" or die $!;
{
    local *STDERR = \*FILE;
    print STDERR "one\n";
}
print STDERR "two\n";

Cheers.

Joe Oppegaard wrote:

> I'm probably missing something obvious, but I can't seem to find the
> answer. How do you redirect stderr in scope, then have it return to its
> default once you leave that block?
>
> Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/archives/pdx-pm-list/attachments/20020416/67a30a22/attachment.htm


More information about the Pdx-pm-list mailing list