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.
+
tip. But couldn't or shouldn't the->
prevented it from being interpreted as a block? – Maladminister