my %newhash = map { $_ => $refdes_bom{$_} } grep { CPN($refdes_bom{$_}) and ITEM($refdes_bom{$_}) } keys %refdes_bom;