my %hash = ( val1 => 1, val2 => 2, val3 => 3, ); print join( ',', map { my $x = "$_:$hash{$_}"; $x } keys %hash );