in reply to Re: Referencing to a hash inside a hash of hashes.
in thread Referencing to a hash inside a hash of hashes.

Also, you don't need the '' around the key values. They'll just cause you trouble later.

They are unnecessary in this instance (and I'm lazy enough to leave out the quotes most of the time also), but I don't see how they'll cause trouble later. Actually, they'll save trouble if he decides to change the keys to something that is a perl keyword, or if perl changes and suddenly 'this', 'that' or 'myhash' becomes a perl keyword.

Update:Hmm, tye right. runrig wrong (see below). Key words and function names don't cause problems, but how 'bout this:
If you decide to add non-word characters later, it can cause trouble unless its quoted so it may save you from remembering to quote it. Or if you later decide to use a hash slice, you'll have to quote the arguments anyway. Or some people just think it looks better, so who am I to argue :)

  • Comment on Re: Re: Referencing to a hash inside a hash of hashes.

Replies are listed 'Best First'.
(tye)Re: Referencing to a hash inside a hash of hashes.
by tye (Sage) on Aug 08, 2001 at 07:25 UTC

    Actually, no. I don't see how they will cause problems later, but $hash{do}, $hash{time}, $hash{__PACKAGE__}, etc. are valid and use the keys "do", "time", and "__PACKAGE__", respectively (unless you have a really old copy of Perl).

            - tye (but my friends call me "Tye")