in reply to Strange compiler behavior with map?
This: { "$_" => 1 }, looks to the compiler sufficiently like an anonymous hash that it (heuristically) decides it must be one, rather than an in-line block. And if it was an anonymous hash, then it would mean you had omitted the comma between it and the next argument. Hence the error.
There are various other strategies you can use to cause the heuristic to decide the other way. A not exhaustive list include:
|
|---|