in reply to Syntax error that I don't understand?

Curlies ambiguity. In places where blocks and expressions are both valid, curlies are normally interpreted as blocks. However, when the code looks like hash construction, the curlies are interpreted as a hash constructor instead.

>perl -ce"map{ qq{@{ $_->[ 0 ] }} => $_ } @a" syntax error at -e line 1, next char @ -e had compilation errors. >perl -ce"map{; qq{@{ $_->[ 0 ] }} => $_ } @a" -e syntax OK

Replies are listed 'Best First'.
Re^2: Syntax error that I don't understand?
by BrowserUk (Patriarch) on Jul 03, 2008 at 04:06 UTC
      If it could happen to him, what chance do the rest of us have?