in reply to Re: Can't find any documentation on < a b c > syntax for lists
in thread Can't find any documentation on < a b c > syntax for lists
"Mostly, that I will stick to qw(...) in the future."
Just be aware of this common mistake:
$ perl -we 'print "$_\n" for qw{ a b c };' a b c $ perl -we 'for qw{ a b c } { print "$_\n"; }' Missing $ on loop variable at -e line 1. $ perl -we 'for (qw{ a b c }) { print "$_\n"; }' a b c
You can leave the parentheses off when for is used as a statement modifier; but not when it introduces a compound statement. See perlsyn for more about that.
It's a common mistake because, although it was never really valid, Perl didn't report a problem until v5.14.0. For details, see:
— Ken
|
|---|