# your code my $columnsum += $_->[$colnum] for @data; # is effectively the same as for (@data) { my $columnsum += $_->[$colnum] } # so as expected $columnsum is effectively localised to that block (li +ne). my $i += $_ for 1..3; print "localised (1) \$i='$i'\n"; for (1..3) { my $i += $_ } print "localised (2) \$i='$i'\n"; $i += $_ for 1..3; print "not localised (1) \$i='$i'\n"; for (1..3) { $i += $_ } print "not localised (2) \$i='$i'\n"; print "Oops, forgot to zero a widely scoped var!";
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Re: 'my' headache...why doesn't this work?
by tachyon
in thread 'my' headache...why doesn't this work?
by S_Shrum
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |