[Purdue-pm] qw{} out in 5.14, and what that means.

Dave Jacoby jacoby at purdue.edu
Tue Aug 16 12:33:10 PDT 2011


I read perldelta and figured it out.

jacoby at oz:~$ ./test.pl && perl -v
1
2
3
1
2
3

This is perl, v5.10.1 (*) built for i486-linux-gnu-thread-multi

That's this code:

     for my $l ( qw{ 1 2 3 } ) {
         say $l ;
         }

     for my $l  qw{ 1 2 3 }  {
         say $l ;
         }

The difference between the first and second for loop is that the second 
for loop has no perens, but it acts like it does. But if you put an 
array in without perens ...

     my @a = qw{ 1 2 3 } ;
     for my $l @a {
         say $l ;
         }

... it dies with good cause. Normal and good uses of qw{} will not go away.

-- 
Dave Jacoby                         Address: WSLR S049
Code Maker                          Mail:    jacoby at purdue.edu
Purdue University                   Phone:   765.49.67368
    965 days until the end of XP support



More information about the Purdue-pm mailing list