Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: How do I print errors

by davido (Cardinal)
on Oct 01, 2003 at 17:00 UTC ( [id://295694]=note: print w/replies, xml ) Need Help??


in reply to How do I print errors

According to perlopentut, "You don't have to accept the STDIN and STDOUT you were given. You are welcome to reopen them if you'd like."

Then the example given, modified to affect STDERR.....

open( STDERR, ">errors.log") or die "Cannot open error log.\n$!";

The tutorial also suggests that that it can be a clever thing to do to close the STD... filehandle on exit from the program, to force a flush.

END { close STDERR or die "Can't close STDERR.\n$!" }

In your case, you simply want to redirect STDERR to the OUTFILE file handle. Also listed in the tutorial, you may do this:

open (STDERR, ">>&OUTFILE") or die "Can't redirect STDERR.\n$!";

Hope this helps!

Dave

"If I had my life to do over again, I'd be a plumber." -- Albert Einstein

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://295694]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-25 23:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found