use Dumpvalue; my $d = new Dumpvalue; #create the hypothetical structure. An array of #hash references each with an id field in it. my @ArrayB = map{{id=>$_}}(0 .. 100); $d->dumpValues(\@ArrayB); print "\n"; #more testing. #these would correspond to id's to remove in our hypothetical #scenario. my @ids_to_remove = (14 .. 36, 50 .. 63, 89, 91, 94); @ArrayB = do{ my @tmp = @ArrayB; map{ my $key = $_->{id}; (!grep /^$key$/, @ids_to_remove) ? $_ : () ; }@tmp; }; $d->dumpValues(\@ArrayB); exit;