in reply to Redirecting STDOUT to a FileHandle ?

And for TIMTOWTDI fans:
open( FOO, "> foo" ) or die( "End of foo is nigh : $!" ); select FOO; # Hang on, isn't 'select' for networking? call_legacy_code(); # Hehe, output goes to foo exit 0; sub legacy_code { # Heh...print to the screen print "I 0wn j000!\n"; }
Caveats:
  1. printing explicitly to STDOUT will still go to STDOUT
  2. This isn't what you asked
  3. You can probably do this with 'FileHandle' objects but this monk is too lazy to check
  4. the reputation of comments may go down as well as up, past performance is no guarantee of future success.