in reply to what does that value mean, when you evaluate hash in a scalar context?
$#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.@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.
|
|---|