is_dup_ref(): extract function from sort_ref_array()