{ my %t; $t{$_} .= "1" for @tax_ids; $t{$_} .= "2" for @db_state; @add = grep $t{$_} eq "1", keys %t; @delete = grep $t{$_} eq "2", keys %t; }