in reply to filtering and dividing an array

I'm a bit unclear on what you want. Maybe splice already does what you want? Otherwise, likely you want to stuff the elements you want (or the ones you don't want) into a hash and part the array based on whether each element is in the hash or not. Maybe List::Part is of convenience there.