#!/usr/bin/perl use strict; open my $fh, '-|', 'bash -c "echo Hello; exit 1"'; print <$fh>; close $fh; my $status = $? >> 8; print "$status\n"; #### Hello 1 #### #!/usr/bin/perl use strict; use autodie; open my $fh, '-|', 'bash -c "echo Hello; exit 1"'; print <$fh>; close $fh; my $status = $? >> 8; print "$status\n"; #### Hello Can't close(GLOB(0x10082a098)) filehandle: '' at test.pl line 7 #### use strict; use autodie; open my $fh, '-|', 'bash -c "echo Hello; exit 1"'; print <$fh>; #close $fh; my $status = $? >> 8; print "$status\n"; #### Hello 0 #### use strict; use autodie; open my $fh, '-|', 'bash -c "echo Hello; exit 1"'; print <$fh>; {no autodie; close $fh;} my $status = $? >> 8; print "$status\n"; #### Hello 1