This code dies as I expect it to:
use strict;
use warnings;
open my $fh, "<", "" or die $!;
But this does not:
use strict;
use warnings;
open my $fh, "<", undef or die $!;
What is going on here?
This code dies as I expect it to:
use strict;
use warnings;
open my $fh, "<", "" or die $!;
But this does not:
use strict;
use warnings;
open my $fh, "<", undef or die $!;
What is going on here?
The open function has lots of little quirks, this is one of them:
Although, as ysth notes in the comments, the documentation strongly suggests that this should only happen for "+<" and ">+" modes. I believe this is the code that implements the behavior. It does not check the mode. I do not know if this is a bug or not, but will report back after talking to P5P.
Apparently, the documentation was fixed in blead perl in November: