You may want to read this. It's an interesting article on how hashes behave. It'll give you some cursory information on how to use them.

Answer/Nitpicking;
@a = (1,2,4,6,8); $a = @a; print $a; It gives you a FIVE, which is quite easy to understand, as it matches +$#a.
$#a is the highest index. $a is the scalar value, or how many numbers are in the array. $array gives you how many numbers are in the array, and $a for a hash gives you the ammount of values used over the ammount of values allocated before the hash needs to get bigger. (Somebody has already explained to you why in the previous post.) Also, check out Shift, Pop, Unshift and Push with Impunity! for some more information on perl's algorithms, in general for datatypes.
Gyan Kapur
gyan.kapur@rhhllp.com

In reply to Re: what does that value mean, when you evaluate hash in a scalar context? by Revelation
in thread what does that value mean, when you evaluate hash in a scalar context? by pg

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.