in reply to Re: beginner question - why is hash key unquoted and in capitals
in thread beginner question - why is hash key unquoted and in capitals

You can use string literals/barewords unquoted in perl (as per the previous posts) only if you run without use strict
That is not true. Example:
use strict; my %hash; $hash{HUBBA}= "it works!"; print $hash{HUBBA};
Barewords as hash-keys are implicitely quoted even under strict.
  • Comment on Re^2: beginner question - why is hash key unquoted and in capitals
  • Download Code

Replies are listed 'Best First'.
Re^3: beginner question - why is hash key unquoted and in capitals
by locked_user sundialsvc4 (Abbot) on Oct 15, 2010 at 16:49 UTC

    I have frequently seen code like:

    my %magic_words = { PLUGH => "A hollow voice says", FOO => "You are nothing but a charlatan", }

    Which is an obviously-intended use for “barewords.”   Nevertheless, I have gotten into the habit of enclosing all literals in single or double quotes.

Re^3: beginner question - why is hash key unquoted and in capitals
by halfcountplus (Hermit) on Oct 15, 2010 at 17:34 UTC

    Correct -- all apologies, will change post.

      btw:

      You should not alter postings in such a way that the original version (especially the parts that subsequent posts refer to) cannot be recovered anymore.

      Doing that leaves discusson threads that don't make any sense when viewed tomorrow.

      If you want to correct mistakes do it like this:

      I never make mistakes.