in reply to Re: Re: Hashes and Refs
in thread Hashes and Refs

Here's a way to think of it that helped me (though it's a little indirect, this is how I latched onto the difference): the => operator you see in hash construction is really just a comma that says "quote barewords to the left of me." So it's a pretty subtle difference between:

my %hash = (1, 2, 3, 4, 5, 6);
and
my %hash = (1=>2, 3=>4, 5=>6);

Both do the same thing; the only difference comes out if you want to have strings as the keys, using the => makes things look nicer, and lets the key/value relationship stand out visually =)

my %quotes_hash = ("bob","carol", "ted","alice"); # vs. my %noquotes_hash = (bob=>"carol", ted=>"alice");

In a lot of respects, hashes are just lists, at least as far as their construction is concerned ... of course the internals are different =)

Philosophy can be made out of anything. Or less -- Jerry A. Fodor