I think the splice thing won't work unless you are going backwards through the array (or something) or using first_index from List::MoreUtils to choose what to splice, since removing entries will mess up the significance of the counter value. Why not keep it simple and just push on to an array of 'values to keep' rather than removing values you don't want?
Totally untested example:
my @entries = ...; my $top_entry = shift @entries; my @keepers; for (@entries) { my $comparison = compare_sub( $top_entry, $_ ); if ( $comparison > $user_defined_value ) { push @keepers, $_; } }
In reply to Re: Iterating through an array using multiple loops and removing array elements
by frozenwithjoy
in thread Iterating through an array using multiple loops and removing array elements
by BiochemPhD
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |