in reply to Question Regarding remove elements from a list

If your logic for examning each element is a little complicated, I'll turn the array into a hash, and delete the key in each pass, something like:
my %hash = map{$_=>undef} @inputs; foreach my $k (keys %hash){ # do something delete $hash{$k} if $do_not_keep; } # then do this loop again...