# make the @$all array the union of everything in # either @$all or @$accounts, excluding the acc 44443 record # (if it exists at all) and exclude any possible duplicates # This "zaps" the duplicate 54321 record. # This literally says, "transfer the input to the output if # the input record isn't about account 44443 and we haven't # already transferred that record to the output before. # This assumes that records are uniquely id'ed by the acc # number. That might or might not be true in the actual # application. my %seen; @$all = grep{ $_->{acc} ne '44443' and !$seen{$_->{acc}}++ } @$all,@$accounts;