Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: what does that value mean, when you evaluate hash in a scalar context?

by Revelation (Deacon)
on Dec 14, 2002 at 18:53 UTC ( [id://219881]=note: print w/replies, xml ) Need Help??


in reply to what does that value mean, when you evaluate hash in a scalar context?

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
  • Comment on Re: what does that value mean, when you evaluate hash in a scalar context?
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://219881]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-24 04:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found