Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: The CORRECT thinking behind the {}s and the ()s.

by samurai (Monk)
on Sep 16, 2002 at 16:22 UTC ( [id://198287]=note: print w/replies, xml ) Need Help??


in reply to The CORRECT thinking behind the {}s and the ()s.

Curly braces denote anonymous hashes. So %bad_hash only gets one element, whose key is a hash_ref. The regular parenthesis denote an array, which is how you define a hash. $ary[0] is the first key, $ary[1] is the first values, $ary2 is the second key and so on and so forth. => is just a pretty alias to the comma operator.

--
perl: code of the samurai

  • Comment on Re: The CORRECT thinking behind the {}s and the ()s.

Replies are listed 'Best First'.
Re: Re: The CORRECT thinking behind the {}s and the ()s.
by kabel (Chaplain) on Sep 16, 2002 at 16:43 UTC
    the "=>" operator does one thing more than the "," operator: "he" automagically quotes the left argument, for you being able to "say":
    my %hihohash = (hiho => "hiho");

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-19 01:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found