First an apology if this doesn't fit this discussion area

In a node I started about tie and DBI giving me trouble, I apparently made a mistake by saying that I thought %h->{foo} was syntatically clearer than $h{a} and was immediately corrected in this node that it was being deprecated and no experienced perl coder would aggree with me.

Naturally, I have to question that.. $h->{foo} is clearly dereferencing the value of foo in a hashref.. %h->{foo} is clearly dereferencing the value of foo in a hash.

$h{foo} just seems like the exception to the rule if the rules are $=scalar/ref, %=hash, @=list. (clear and concise) Grant it, I believe hashes (and lists) are implemented as refs behind the scene and in that sense it makes sense.. It just looks weird to me. Again.. My opinion.

Now.. %h{foo} would be clearer yet.. But I take offense to the statement that experienced perl coders wouldn't use it.. possibly implying that I'm not experienced.. Grant it, I'm no saint.. but I'm no slouch either. Can I be that wrong if %h{foo} is introduced in perl6: Exegesis 2 At least someone thinks it could be written clearer.

I'm not trying to start a flame war here, but I am curious as to why people think %h->{foo}/$h->{foo} is less clear than $h{foo}/$h->{foo}.

What's your opinion? 8)


In reply to %h->{foo} vs. $h{foo}.. by smferris

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.