Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
    
    open (STDOUT,">&=1") or die $!;  
    print "foo bar\n"; # Hoped it went to screen, but goes to log
    
  2. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
    close STDOUT; # Gone forever
    
    open (STDOUT,">&=1") or die $!; # death - goodbye cruel world
    
  3. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
    
    open (STDOUT, ">/my_log"); # Don't have write permission to /
    print "foo bar\n"; # Goes to screen since it is preserved