Help for this page

Select Code to Download


  1. or download this
    open(STDOUT, '> myfilename.txt'); #reopen STDOUT as a file
    print "This goes to the file\n";
    
  2. or download this
    open(OUTFILE, '> myfilename.txt');
    print "This goes to the screen\n";
    open(STDOUT, '>&OUTFILE'); #dup STDOUT to OUTFILE
    print "This goes to the file\n";