Skip to content

Instantly share code, notes, and snippets.

@krimdomu
Created November 24, 2010 14:12
Show Gist options
  • Save krimdomu/713703 to your computer and use it in GitHub Desktop.
Save krimdomu/713703 to your computer and use it in GitHub Desktop.
update one hash from another, recursive
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