Syntax error in hashref lookup, can not see why
问题 perl -E 'say for map s/(æ|ø|å)/ {qw(æ ae ø oe å aa)}->{$1}/ger, qw(rød gul blå)' perl -E 'say for map s/(æ|ø|å)/"".{qw(æ ae ø oe å aa)}->{$1}/ger, qw(rød gul blå)' The first line above gives me syntax error at -e line 1, near "}->" but the second prints roed , gul and blaa as expected. Is this a weakness of the compiler or are there some reason for it that I can't see? I tested and got this behaviour in versions 5.10, 5.22 and 5.26. 回答1: The {...} are interpreted as a BLOCK, not a hashref. We