What is difference between: -
while( my($index, $value) = each @rocks )
and
while((my $index,my $value) = each @rocks )
You can see what Perl thinks the difference is by using the O compiler backend interface to the B::Deparse module (invoked here with -p full parenthesization):
>perl -wMstrict -MO=Deparse,-p -le "my @rocks = qw(a b c); ;; while (my ($i, $v) = each @rocks) { print qq{$i: '$v'}; } ;; while ((my $i, my $v) = each @rocks) { print qq{$i: '$v'}; } " BEGIN { $^W = 1; } BEGIN { $/ = "\n"; $\ = "\n"; } use strict 'refs'; (my(@rocks) = ('a', 'b', 'c')); while ((my($i, $v) = each(@rocks))) { do { print("${i}: '${v}'") }; } while ((my($i, $v) = each(@rocks))) { do { print("${i}: '${v}'") }; } -e syntax OK
Apparently, Perl doesn't think there is any difference at all. (Same results under Strawberries 5.12.3.0 and 5.14.2.1.)
See also Basic debugging checklist.
In reply to Re: Use of "my" after Perl v5.14
by AnomalousMonk
in thread Use of "my" after Perl v5.14
by Rohit Jain
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |