in reply to Can't find any documentation on < a b c > syntax for lists

Thank you all, I have learned a lot!
Mostly, that I will stick to qw(...) in the future. Safety first :-).

My belief is strengthened!

Replies are listed 'Best First'.
Re^2: Can't find any documentation on < a b c > syntax for lists
by kcott (Archbishop) on Feb 14, 2023 at 23:16 UTC
    "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