sub mergedHashKeys{
my( $r1, $r2 ) = @_;
my %h = ( %{ $r1 }, %{ $r2 } );
return [ keys %h ];
};;
$hash1 = {
common_key => 'foo',
hash1_specific_key => 'some value'
};;
$hash2 = {
common_key => 'bar',
hash2_specific_key => 'some other value'
};;
pp mergedHashKeys( $hash1, $hash2 );;
["hash2_specific_key", "common_key", "hash1_specific_key"]
Or if you are into programming in hieroglyphics, just: sub mergedHashKeys{
[ keys %{{ %{ $_[0] }, %{ $_[1] } }} ]
};;
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
|