in reply to what's wrong with that syntax construction?

Without the parens, the first 'rand' is taken as a string; and that causes the parser to see { 'rand' => rand } as an anomymous hash.

With the parens, it parses { rand() => rand } as an anonymous block as you intend.

You can also force the parser to see the anonymous block like this: my @x = map {; rand => rand } (0 .. 5);.

The extra semicolon is legal inside an anonymous block, but not in an anonymous hash, so the parser gives the benefit of the doubt and goes the way you intend.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice. Not understood.