You are right about the scope and actually for my purposes it is not necessary. I shouldn't have included the die at the end as it's output and the modified hash structure is not required. Sorry.
perldoc says "The foreach loop iterates over a normal list value and sets the scalar variable VAR to be each element of the list in turn." So I was expecting to be able to use a hash reference as VAR. It doesn't mention aliasing. But as you say, the answer does appear to be No.
In reply to Re^2: You can't assign $_ to a hash in a foreach statement
by markdibley
in thread You can't assign $_ to a hash in a foreach statement
by markdibley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |