This achieves your goal. But it still loops, albeit that the loop is hidden:
%hash1 = qw( a b c d e f ); %hash2 = qw( a J e K y z ); @sharedKeys = grep defined( $hash2{ $_ } ), keys %hash1; @hash1{ @sharedKeys } = @hash2{ @sharedKeys };; print %hash1;; e K c d a J
In reply to Re: merging two hashes and updating the 1st hash keys.
by BrowserUk
in thread merging two hashes and updating the 1st hash keys.
by sathiya.sw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |