Update: hmm... on further reading, I think the original point was that you don't need the scalar instead of the notion that adding parens would clarify what keys was doing.... so, nevermind.


Why would the parens make it any clearer? I think you might be misunderstanding whats happening here. From keys:

In a scalar context [keys], returns the number of keys [in the hash]
Comparing this to length (since it behaves in a similiar way) which of these is clearer:
$x = length $y; $x = (length $y);

It looks like you think (keys %y) behaves like @{[keys %y]}... i.e. return the list of keys, package them up into an array, then return the member count of the array.

-Blake


In reply to Re: Re: Re: Little things ;) by blakem
in thread Little things ;) by Caillte

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.