Or even:my $result = eval { close $fh }; unless ($result) { print "Got an error: $@\n"; }
my $result = eval { open my $fh, '-|', 'bash -c "echo Hello; exit 1"'; print for <$fh>; close $fh; }; ...
In reply to Re: close and autodie on pipes
by runrig
in thread close and autodie on pipes
by apomatix
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |