If you have a hash of hashes (HoH), such as you have here, then you need to recurse through each level accordingly. The comma separator won't cut it. Here's a quick reference:
foreach my $key (keys %hash)
{
foreach my $subkey (keys %{$hash{$key}})
{
print "$key,$subkey => $hash{$key}{$subkey}\n";
}
}
This presumes you have a pure HoH structure, which is a fairly safe assumption if you've created it yourself. Note that in the second
foreach you're casting the hash entry
$hash{$key} as a hash itself so you can access the keys and iterate through this second layer.