Peter Scott wrote in perl.fwp :
> Here's a distillation of something that just bit me, behaves the same on
> 5.6.1 and 5.8.5.  Observe the following program:
>
> for (1..2) {
>   print_file($0);
> }

(1..2) constructs a new list of anonymous values. qw(one two), or,
equivalently, (1,2), is just a list, with readonly values to which $_
will be aliased. The difference is in the usage of C<..>.

> for (qw(one two)) {
>   print_file($0);
> }
>
> sub print_file {
>   local @ARGV = shift;
>   while (<>) { print }
> }
>
> __END__
>
> Before running it, can you tell:
>   Will it succeed or not?
>   If not, with what error?
>   Where?
>   Why?
>

Reply via email to