Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl 
    use strict;
    ...
    close STDERR;
    open FH, '>', 'log';
    die "exit from program\n";
    
  2. or download this
    #!/usr/bin/perl 
    use strict;
    ...
    open FH, '>', 'log';
    dup2(fileno FH, 2);
    die "exit from program\n";
    
  3. or download this
    #!/usr/bin/perl 
    use strict;
    ...
    # this would be placed into 'stderr', not into 'log'
    warn "STDERR descriptor is:", fileno(STDERR), "\n";
    die "exit from program\n";