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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^7: Wrong idioms (open $fh, '<', undef)
by vsespb (Chaplain) on Apr 02, 2013 at 09:47 UTC | |
by Anonymous Monk on Apr 02, 2013 at 12:12 UTC |
In Section
Seekers of Perl Wisdom