- or download this
open my $output, '>-' or die $!;
- or download this
open my $output, '>&', *STDOUT or die $!;
- or download this
open my $output, '>-' or die $!;
close *STDOUT;
print {$output} "This fails with Bad file descriptor";
- or download this
open my $output, '>&', *STDOUT or die $!;
close *STDOUT;
print {$output} "This prints OK\n";
- or download this
my $output = *STDOUT;
- or download this
close STDOUT;
print {$output}
'Besides Bad file descriptor, this will also warn "print() on clos
+ed filehandle STDOUT"';
- or download this
#!/usr/bin/perl
use strict;
...
my $what = shift;
my $code = $dispatch{$what} or die 'Not associated';
test($code);