I have an array containing a set of elements. The order of the elements does not matter - I use an array, as this is the simplest data structure that I know in Perl.
my @arr = ...
while (some condition) {
}
I know splice(), but I think it’s not good using it during iteration. deletefor array elements seems deprecated. Perhaps use grepon @arrin ( @arr = grep {...} @arr)?
What is the best practice here?
Perhaps use a hash (although I really don't need this)?
source
share