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");