Given the potential for confusion that has been shown from Indirect Object Syntax, it seems that this is another place where confusion could arise.
I think there is a significant difference though: For indirect object syntax, Perl has to use heuristics that are also based on things not near the piece of code being parsed (spooky action at a distance), so that when encountering e.g. new File $path, $data, both perl and the human reading the code have to "guess" as to what was meant. For hash keys on the other hand, the rules for what is autoquoted are clear, so the only potential for confusion is on the side of the programmer not knowing the autoquoting rules. $hash{key} is always the same as $hash{"key"}, no matter if the bareword key is also a filehandle, sub, package name, etc. - but OTOH, for example $hash{a b} is not the same as $hash{"a b"}, which is sometimes surprising to coders. Further reading:
Minor edits for clarity.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|