in reply to Syntax question with

Perl has to guess whether the open curly brace after the map is the beginning of an anonymous array constructor or a block, since it could be both. It does this by "peeking ahead" a bit to see what's there.

I've learned to force it to guess right when needed by either putting a plus in front of the open curly (for the anonymous hash flavor) or a semicolon immediately after the open curly (for a block). Pretty rare to need that, but when I do, it's handy that I recall those tricks. I first learned of that from perlref.

-- Randal L. Schwartz, Perl hacker