Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: A Strange print() predicament.

by jasonk (Parson)
on Feb 19, 2003 at 21:41 UTC ( #236832=note: print w/replies, xml ) Need Help??

in reply to A Strange print() predicament.

Making a copy of STDOUT that redirects the text that gets printed is one way, though there are probably better solutions than this...

#!/usr/bin/perl -w use strict; print "Print this\n"; { local *STDOUT; open(STDOUT,">/dev/null"); # don't allow this include file to print anything do ""; close(STDOUT) } print "Print this too\n";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://236832]
[hippo]: It's always good to start the day with a laugh and Re^2: Subroutine processes only one file in the directory has genuinely made me do so. Well done, sridhar56!
[Discipulus]: :=)
[johngg]: hippo Yes, that's a cracker :-D
[Discipulus]: hippo take a look at Re^2: Cookie->fetch problem

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (11)
As of 2017-05-26 08:14 GMT
Find Nodes?
    Voting Booth?