[Israel.pm] Importing values from a 2D hash into another 2D hash

Ran Eilam ran.eilam at gmail.com
Mon Oct 29 12:04:32 PDT 2012


Returning a new value instead of mutating the sub arguments:

sub combine_values {
  my $old = shift;
  my $new  = shift;
  return map {$_ => {
      %{ $old->{$_} },
      %{ $new->{$_} || {} }
  }} keys %$old;
}

Ran


More information about the Perl mailing list