my %merge; for my $key ( keys %myhash ) { push $merge{join $;, sort @{$myhash{$key}}}, $key; }