Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: A Strange print() predicament.

by BigLug (Chaplain)
on Feb 19, 2003 at 22:44 UTC ( #236864=note: print w/ replies, xml ) Need Help??


in reply to A Strange print() predicament.

Previous solutions have suggested redirecting STDOUT, which would work, but consider using the built in one-argument select statement:

$oldFH = select(NOTHING); do "filename.txt"; print "Won't Print\n"; select($oldFH); print "Will Print\n";
The select statement will change the default filehandle for all manner of things, including $| and print. It also means that if a called module does something like:
print STDOUT "This will print";
... then it will print. However I'd be surprised if any module actually does this. It also gives you an 'out' if you want to force something to print while you have the select redirected.


Comment on Re: A Strange print() predicament.
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2014-09-20 03:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (152 votes), past polls