IIRC, doing use diagnostics; increases the verbosity of the warning to the extent that it mentions the category.
Update: Yes, that seems to be the case.
$ perl -Mstrict -Mwarnings -E '
> my @arr = qw{ abc #def ghi };'
Possible attempt to put comments in qw() list at -e line 2.
$ perl -Mstrict -Mwarnings -Mdiagnostics -E '
my @arr = qw{ abc #def ghi };'
Possible attempt to put comments in qw() list at -e line 2 (#1)
(W qw) qw() lists contain items separated by whitespace; as with l
+iteral
strings, comment characters are not ignored, but are instead treat
+ed as
literal data. (You may have used different delimiters than the
parentheses shown here; braces are also frequently used.)
You probably wrote something like this:
@list = qw(
a # a comment
b # another comment
);
when you should have written this:
@list = qw(
a
b
);
If you really want comments, build your list the
old-fashioned way, with quotes and commas:
@list = (
'a', # a comment
'b', # another comment
);
$
|