in reply to (proposed)Scoping tutorial

Says arturo:
> use foreach my $element (@array) {... } ... $element will be set to
> the value of the current element of the array on each step through
> the array, and modifying it won't change your array.
Wrong. (Good thing I caught that for you, because you say that's one of your favorite uses, and it's probably just dumb luck that you haven't gotten into big trouble by modifying the loop variable when you thought you were safe from modifying the array.)

> local $foo ... determines that in the
> current block and any code called by the current
> block, $foo refers to a different variable.

Also wrong. It's the same variable. Nor does local affect the interpretation of $foo in called subroutines.

local changes the value of the variable. It saves the old value, and arranges for the old value to be automatically restored later on.

Called subroutines see the new value of $foo, just as if you had assigned to it.

Hope this helps.