in reply to Use of "my" after Perl v5.14
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Use of "my" after Perl v5.14
by Rohit Jain (Sexton) on Sep 21, 2012 at 06:36 UTC | |
by AnomalousMonk (Archbishop) on Sep 21, 2012 at 08:23 UTC |