Documentation for strict 'subs' states: ... generating a compile-time error if you try to use a bareword identifier that's not a subroutine, unless it ... appears in curly braces...
Thanks for your reply. I still think it is inconsistent
It's not. The barewords don't appear in curly braces, they appear in a list.
$ perl -c -e'use strict; my %h; $h{foo}' -e syntax OK $ perl -c -e'use strict; my %h; $h{map $_, foo}' Bareword "foo" not allowed while "strict subs" in use at -e line 1. -e had compilation errors. $ perl -c -e'use strict; my %h; $h{f(foo)}' Bareword "foo" not allowed while "strict subs" in use at -e line 1. -e had compilation errors. $ perl -c -e'use strict; my %h; $h{foo,bar}' Bareword "foo" not allowed while "strict subs" in use at -e line 1. Bareword "bar" not allowed while "strict subs" in use at -e line 1. -e had compilation errors.
In reply to Re: Unquoted hash slice keys with use strict 'subs'
by ikegami
in thread Unquoted hash slice keys with use strict 'subs'
by cdarke
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |