Help for this page

Select Code to Download


  1. or download this
    open(FOO,">/temp/foo") || die $!;
    sub foo { local *STDOUT=*FOO; print "foo"; } #yes, this is supposedly 
    +to STDOUT
    foo;
    close(FOO);
    
  2. or download this
    *FOO=*STDOUT; #Save it somehow
    open(STDOUT,">>outputfile") || die $!;
    sub foo { print "foo bar"; }
    foo;
    close(STDOUT);
    *STDOUT=*FOO;