Created
November 24, 2010 14:12
-
-
Save krimdomu/713703 to your computer and use it in GitHub Desktop.
update one hash from another, recursive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub update_hash { | |
return $_[1] unless(ref($_[0])); | |
map { $_[0]->{$_} = update_hash($_[0]->{$_}, $_[1]->{$_}) if (defined $_[1]->{$_}) } keys %{$_[0]} if ref($_[0]); | |
$_[0]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment