Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Use select to redirect STDOUT (Was Re: Opening and Closing STDOUT)

by hiseldl (Priest)
on Mar 05, 2003 at 14:23 UTC ( #240583=note: print w/replies, xml ) Need Help??


in reply to Opening and Closing STDOUT

Instead of closing and opening STDOUT, you could use select as follows:

open(JUNK, ">junk.txt") or die; print "this is going to stdout\n"; select JUNK; print "this is going to junk\n"; select STDOUT; print "this is again going to stdout\n";

This way you can leave your filehandles open and switch whenever you need to with little effort.

HTH.

--
hiseldl
What time is it? It's Camel Time!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2022-05-25 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (90 votes). Check out past polls.

    Notices?