# untested! my %b; open(B, "<" . DUMP_B) || die("Could not open file \n"); while () { chomp; my ($id, $ac) = split /\|/, $_; push @{$b{$id}}, $ac; } open(A, "<" . DUMP_A) || die("Could not open file \n"); while() { chomp; my $ac = $b{$_} || []; print "$_: ", join(', ', @$ac), "\n"; }