This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Stop trying to disambiguate {} after $
$ ./perl -Ilib -e '${function_with_side_effects,42}'
$ ./perl -Ilib -e '${Function_with_side_effects,42}'
syntax error at -e line 1, near "${"
Execution of -e aborted due to compilation errors.
Why is the second one a syntax error?
Because the lexer is trying to disambiguate between a block and a hash
when it sees ‘{’ after ‘$’. But an anonymous hash constructor cannot
come after a funny character, so any time it chooses the hash inter-
pretation over the blocky one, a syntax error ensues.