summaryrefslogtreecommitdiff
path: root/pod
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2010-09-08 09:51:29 +0200
committerRafael Garcia-Suarez <rgs@consttype.org>2010-09-08 10:15:44 +0200
commitea25a9b2cf73948b1e8c5675de027e0ad13277bd (patch)
tree2b8bc87185e0e9e01b643752f911cdf4eeac0f85 /pod
parentc99cfaa7c4ced6145d9642cd15da5bb2ea4ad19e (diff)
downloadperl-ea25a9b2cf73948b1e8c5675de027e0ad13277bd.tar.gz
make qw(...) first-class syntax
This makes a qw(...) list literal a distinct token type for the parser, where previously it was munged into a "(",THING,")" sequence. The change means that qw(...) can't accidentally supply parens to parts of the grammar that want real parens. Due to many bits of code taking advantage of that by "foreach my $x qw(...) {}", this patch also includes a hack to coerce qw(...) to the old-style parenthesised THING, emitting a deprecation warning along the way.
Diffstat (limited to 'pod')
-rw-r--r--pod/perldiag.pod11
1 files changed, 11 insertions, 0 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index fc146a0dd3..7bd44980fd 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -5055,6 +5055,17 @@ name. So no namespace is current at all. Using this can cause many
otherwise reasonable constructs to fail in baffling ways. C<use strict;>
instead.
+=item Use of qw(...) as parentheses is deprecated
+
+(D deprecated) You have something like C<foreach $x qw(a b c) {...}>,
+using a C<qw(...)> list literal where a parenthesised expression is
+expected. Historically the parser fooled itself into thinking that
+C<qw(...)> literals were always enclosed in parentheses, and as a result
+you could sometimes omit parentheses around them. (You could never do
+the C<foreach qw(a b c) {...}> that you might have expected, though.)
+The parser no longer lies to itself in this way. Wrap the list literal
+in parentheses, like C<foreach $x (qw(a b c)) {...}>.
+
=item Use of reference "%s" as array index
(W misc) You tried to use a reference as an array index; this probably