$ perl5.12.5 -we'for my $k qw(a b) {$_=$k}'
$ perl5.14.0 -we'for my $k qw(a b) {$_=$k}'
Use of qw(...) as parentheses is deprecated at -e line 1.
$ perl5.16.3 -we'for my $k qw(a b) {$_=$k}'
Use of qw(...) as parentheses is deprecated at -e line 1.
$ $ perl5.18.0 -we'for my $k qw(a b) {$_=$k}'
syntax error at -e line 1, near "$k qw(a b)"
Execution of -e aborted due to compilation errors.
####
=head2 Use of qw(...) as parentheses
Historically the parser fooled itself into thinking that C literals
were always enclosed in parentheses, and as a result you could sometimes omit
parentheses around them:
for $x qw(a b c) { ... }
The parser no longer lies to itself in this way. Wrap the list literal in
parentheses like this:
for $x (qw(a b c)) { ... }
This is being deprecated because the parentheses in C
are not part of expression syntax. They are part of the statement
syntax, with the C statement wanting literal parentheses.
The synthetic parentheses that a C expression acquired were only
intended to be treated as part of expression syntax.
Note that this does not change the behaviour of cases like:
use POSIX qw(setlocale localeconv);
our @EXPORT = qw(foo bar baz);
where parentheses were never required around the expression.
##
##
=head2 qw(...) can no longer be used as parentheses
C lists used to fool the parser into thinking they were always
surrounded by parentheses. This permitted some surprising constructions
such as C, which should really be written
C. These would sometimes get the lexer into
the wrong state, so they didn't fully work, and the similar C that one might expect to be permitted never worked at all.
This side effect of C has now been abolished. It has been deprecated
since Perl v5.13.11. It is now necessary to use real parentheses
everywhere that the grammar calls for them.