New(?) for qw(...) error

Sébastien Aperghis-Tramoni maddingue at free.fr
Tue Mar 27 13:55:57 BST 2007


Paul Makepeace <paulm at paulm.com>:

> I've just had one of my dodgier scripts start bailing on this construction,
>
> $ perl -le 'for $a qw(a b) { print $a }'
> a
> b
> $ perl -le 'for qw(a b) { print }'
> Missing $ on loop variable at -e line 1.
>
> This is on 5.8.8; not sure when this kicked in.

In normal form (not the postfix one), for() has always wanted the brackets
around the list:

  $ /usr/local/perl/5.4.5/bin/perl -le 'for qw(a b) { print }'
  Missing $ on loop variable at -e line 1.

--
Sébastien Aperghis-Tramoni

Close the world, txEn eht nepO.


More information about the london.pm mailing list