in reply to Re^13: Why? (each...)
in thread Why? (each...)

You said that parens when assigning to a hash indicates a list and not a hash reference. In that very context, I showed that's wrong. If anyone followed your advice, and used %hash instead of $hash, their code would be buggy.

Replies are listed 'Best First'.
Re^15: Why? (each...)
by Argel (Prior) on May 16, 2011 at 18:15 UTC
    The context is %hash, not $hash. The mistake in the OP was using {} when he should have used ().

    Elda Taluta; Sarks Sark; Ark Arks

      The context is actually "I still am fuzzy about the difference between “square brackets,” “braces,” and “parentheses.”".

      You said parens indicate a list, so that would mean %hash should be used.

      sub g { return { ... } } sub h { return { ... } } my %hash = (f ? g : h);

      That's wrong wrong wrong.

        I took the context to be like how it was used in the OP -- i.e. something like "When declaring and initializing hashes (%) and arrays (@), do I use {}, [], or () to assign the values?".

        Elda Taluta; Sarks Sark; Ark Arks