Help for this page

Select Code to Download


  1. or download this
    
       sub your_function {
    ...
         # Either way we don't need it any more.
         close OUTFH;
       }
    
  2. or download this
        your_function( $string, \*INPUT, '/tmp/somefile' );
    
  3. or download this
        # print to STDOUT instead of to disk
        your_function( $string, \*INPUT, "&STDOUT" );
    ...
        open OUTPUT, '> /tmp/somefile'
            or die "/tmp/somefile: $!\n";
        your_function( $string, \*INPUT, "&OUTPUT" );
    
  4. or download this
         open OUTFH, ">$out" or die "$out: $!\n";
    
  5. or download this
         # wrong: given, eg, &STDOUT, creates a file named '&STDOUT'
         open OUTFH, "> $out" or die "$out: $!\n";
    
         # wrong: also creates, eg, '&STDOUT'
         open OUTFH, '>', $out or die "$out: $!\n";