in reply to Scoping Problem
BLOCK4:{ my $year=$year;--$year; print "We change \$year to $year\n"; +}
As mentioned before, $year's scope doesn't change until after my $year = $year; has executed. Thus, if you change $year anywhere after that statement executes, it will just change the $year within the scope and leave global $year alone.
antirice
The first rule of Perl club is - use Perl
The ith rule of Perl club is - follow rule i - 1 for i > 1
|
|---|