Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: interleaf stdout stderr to a file

by kennethk (Abbot)
on Mar 03, 2015 at 00:42 UTC ( [id://1118513]=note: print w/replies, xml ) Need Help??


in reply to interleaf stdout stderr to a file

You should be able to accomplish this using select and the special variable $| to turn off buffering:
select(STDERR); $| = 1; select(STDOUT); $| = 1;
Of course, you'll likely have trouble if you execute your command as listed above, since the channels will clobber each other. You probably mean
script.pl > script.out 2>&1

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Replies are listed 'Best First'.
Re^2: interleaf stdout stderr to a file
by hg2 (Initiate) on Mar 03, 2015 at 15:12 UTC
    thanks this worked great!

Log In?
Username:
Password:

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

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

    No recent polls found