Welcome to the Monastery | |
PerlMonks |
Re^2: Removing elemets from an arrayby linuxer (Curate) |
on Dec 30, 2012 at 17:58 UTC ( [id://1010949]=note: print w/replies, xml ) | Need Help?? |
I hope you Take this example:
This results in:
As one can see, outside the sub, the array is changed as well.
In the current setting, this might be not very severe. But there might be situations, where this is fatal! You should use separate arrays inside your sub routines (my @work = @array;), or localize the variables (local @array = @array;) inside the sub routines.
In Section
Seekers of Perl Wisdom
|
|