in reply to Re: Suppressing console output
in thread Suppressing console output

The faster/easier way to do that is:

{ local *STDOUT; open STDOUT, '>/dev/null'; # do stuff that may print out. }
Note also that you're creating $mySTDOUT and $oldSTDOUT and not actually using them anywhere. $mySTDOUT is not the same thing as *mySTDOUT!

Replies are listed 'Best First'.
Re^3: Suppressing console output
by Lunchy (Sexton) on Sep 16, 2005 at 20:02 UTC
    I knew that $mySTDOUT isnt' the same as *mySTDOUT, but I thought I needed to create something with a 'mySTDOUT' name to keep strict from barking about *mySTDOUT, but it turns it I didn't need to. :)

    As far as not using *oldSTDOUT. You'll note I mentioned that he could use *oldSTDOUT to restore STDOUT to normal later on if he wanted to. Perhaps there's another way to do this, but if so I don't know what it is. :)

    By the way, I DO like your solution and will try to remember it for the next time I need to do this, however, it does assume one is on an OS that has a /dev/null. :)

    Cheers!

    -Lunchy