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

Interesting how we seem to have never been on the same page on this and probably never will be. As an example:
But we do that so we can assign a list of key/value pairs to the hash.
Not true at all. Parens are only used in assigning lists of key/value pairs to hashes in a small percentage of situations.
Yet that is precisely where the OP made his mistake and thus the actual context I have been discussing this in (and the same situation for arrays)!! Which I have explained before. If we are not on the same page and apparently never will be, then there's no point in continuing.

Elda Taluta; Sarks Sark; Ark Arks

Replies are listed 'Best First'.
Re^24: Why? (each...)
by ikegami (Patriarch) on May 19, 2011 at 15:46 UTC

    You've said two contradictory things repeatedly. That the context is my %hash = ( a => 1, b => 2 );, and that it's about the mistake the OP made. Either one I address, you say the other is the context.

    Both have been addressed.

    It's been shown why parens don't indicate it's a list in my %hash = ( a => 1, b => 2 );.

    It's been shown that saying that parens indicate a list doesn't help initialise a hash correctly.

      How is knowing that parens are used to override precedence helpful to someone that has trouble remembering whether to use %hash=(a=>1,b=>2) vs. %hash={a=>1,b=>2}?!? It's not. And so we are are still not on the same page. And like I said, we probably never will be, especially if you continue to be so hung up on black and white absolutes. I have explained several times now my viewpoint on this and at this point I can only conclude that gray areas like "indicate" are beyond your grasp. If I gave you "%hash=(" and asked you what you would normally expect to follow it what would your answer be? Something like "a=>1,b=>2)"? Edit: And if I gave you %hash=@" what would you expect to follow it? Something like "array"? So given the context, the opening paren does indicate (hint, suggest, pick a synonym) that a list will follow?

      Elda Taluta; Sarks Sark; Ark Arks

        How is knowing that parens are used to override precedence helpful to someone that has trouble remembering whether to use %hash=(a=>1,b=>2) vs. %hash={a=>1,b=>2}?!?

        Straw man. The answer I gave to that is "One never uses {} or [] to initialise a hash or array"! I didn't mention parens at all in describing how to initialise a hash. After all, they've got nothing to do with it.

        I would mention them in describing how to build a list, though, because they are often needed around list literals.

        If I gave you "%hash=(" and asked you what you would normally expect to follow it what would your answer be? Something like "a=>1,b=>2)"??

        No. It's definitely a possibility, but I'd often be wrong if I would expect that.