http://www.perlmonks.org?node_id=510260


in reply to syntax error with map in list context

There are two ways to unconfuse perl about whether you mean a block or an anonymous hash, depending on which one it is:

  1. +{ ... } is always considered an anonymous hash. The unary plus is generally used to explicitly signify that what follows is an expression.

  2. {; ... } is always considered a block.

You’ll find that if you write your code as map {; ... } ..., it works.

Makeshifts last the longest.