Feature. for/foreach variables are refences (in the C meaning) instead of copies. If you want to copy, try this:
@test = (1,2,3,4); foreach (@test) { my $_tempvar = $_; $_tempvar = "A"; } print @test;
In reply to Re: foreach array manipulation
by ikegami
in thread foreach array manipulation
by nwkcmk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |