in reply to Re^5: Wrong idioms (open $fh, '<', undef)
in thread Wrong idioms
I mean open does not detect error if you "open" a directory.
Sure it does
$ perl -e " open $dirname, q/../ or die $!, $/, $^E, $/ " Permission denied Access is denied $ perl -e " open $dirname, q/../ or die join qq/\n/, $!,$^E,grep( { $! +{$_} } keys %! ) " Permission denied Access is denied ERROR_INVALID_DATA EMARCH_ENC_I17_IMM5C_INST_WORD_POS_X EMR_SETBRUSHORGEX EVENT_SYSTEM_CONTEXTHELPEND EACCES at -e line 1.
Also last code with "wantarray" and "scalar" looks useless.
No, its is not useless. You must not know perl well.
In Section
Seekers of Perl Wisdom