in reply to Perl Tutorial code uses "qw" but has an error when run
Sometime along the way, things were changed so that you couldn't any longer use an open qw() in a for loop, you must enclose the qw statement in an outer list:
perl -wMstrict -E 'for my $d (qw(1 2 3)){say $d}' 1 2 3
I do not have time to dig through the perldeltas right now, but switching to 5.10.1, the following works:
perl -wMstrict -E 'for my $d qw(1 2 3){say $d}' 1 2 3
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl Tutorial code uses "qw" but has an error when run
by Tio Cash (Novice) on May 03, 2018 at 11:27 UTC |