- or download this
#!/usr/bin/perl
use strict;
...
close STDERR;
open FH, '>', 'log';
die "exit from program\n";
- or download this
#!/usr/bin/perl
use strict;
...
open FH, '>', 'log';
dup2(fileno FH, 2);
die "exit from program\n";
- 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";