for (sort keys %h2) { print join " ", $_, values %{$h2{$_}}; }