in reply to join two hashes

i am beginner but i did it as this code

my @key=keys %rep; for my $key(@key){ $new_hash{$key}="[$rep{$key},$comb{$key}]";}

please professionals tell me is it correct or not.

Replies are listed 'Best First'.
Re^2: join two hashes
by Anonymous Monk on Jul 30, 2011 at 11:51 UTC
    Well, it doesn't accomplish your stated goal, storing two values for one key, which is accomplished by storing an array reference

    What this does is store one value, a scalar, a string

    If this is what you want, then it is correct :)