146

Input/Output
Stupid Open Tricks

  • You can also use the open() function to re-open or re-direct i/o streams

  • Open a new stream that points to STDOUT

      open( SAVEOUT, ">&STDOUT" );

  • Open a new stream that points to STDERR

      open( SAVEERR, ">&STDERR" );

  • Re-direct STDOUT to point to a file

      open( STDOUT, ">redirect.out" );

  • Re-direct STDERR to point to STDOUT

      open( STDERR, ">&STDOUT" );