in reply to Modifying an array of hashes
Adding, replacing or removing elements an array over which you are iterating should be avoided.
for (@a) { push @a, ...; # XXX Avoid splice @a, ...; # XXX Avoid pop @a; # XXX Avoid }
Changing the value of an array element is fine, as is changing variables referenced by them
for my $person (@people) { # Do anything you want to $person # Do anything you want to $person->{whatever} }
In your code, you are iterating over a list of numbers that you can't even change if you wanted to. There's definitely no harm in that.
|
|---|