The following does not die:
open my $in, '<', undef or die q{couldn't open undef}; print <$in>;
Also this:
open my $in, '>', undef or die q{couldn't open undef}; print $in 'hello';
I donβt understand why not one of them dies. How is it possible the discovery of undef possibly successful? The reason I found this was because the guy I work with did this:
open my $in, '>', $ARGV[0] or die q{couldn't open $ARGV[0]};
He thought that this would kill the script if no arguments were passed (I know that this is not the cleanest way to do this, but I did not think that this would not work).
I am using Strawberry 5.16.1.
undefined file-io perl
Nate glenn
source share