In my $year = --$year;the decrement operator is changing the $year in the OUTSIDE scope, then assigning it to the lexical $year in the INSIDE scope (which is the one that your print statement in BLOCK4 sees). Remember, until that statement finishes successfully, the INNER $year doesn't exist.
You could get the behavior you're looking for with: my $year = $year - 1;which doesn't change the value of the OUTER $year.
Update
Added example in second para.
In reply to Re: Scoping Problem
by VSarkiss
in thread Scoping Problem
by nimdokk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |