Sorry, but you misunderstood what I meant, or maybe I didn't express myself clearly.As a side note, I wonder wether perl could emit a warning when one tries to open() an anonymous file for reading (or for writing) only... or are there common situations in which it could be desirable to do so?Perl doesn't warn on deliberate features, whether common or not. Perl autovivifies undefined filehandles, and array and hash references, and allows you to do my $var; $var += 3; without warning as well. They are all features.
I'm not referring to autovivification et similia in general, of which I am aware too and that I consider to be great features myself as well.
I am referring to a particular, "special" open() feature, and in particular that of opening an an anonymous FH when it is passed undef as a third argument with the three-args form of call.
You'll notice that the example given in the doc itself is with mode '+>', that it says one can also use '+<' instead, but it gives a warning about it.
The cmt I made was about opening such anonymous files in '<' (or '>') mode, which could have a sense if the FH is subsequently duplicated, but which is likely, IMHO, not to be what the average user would want in the first place...
In reply to Re^2: I've been bit in the neck by open()
by blazar
in thread I've been bit in the neck by open()
by blazar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |