in reply to Assign (key, value) to a hash w/o clobbering hash
OK, possibly a sledge hammer to crack a nut, depends on how many time you are doing it.sub add2hash { my ($value, $hashref) = @_; my @array = (split /X/, $value); $hashref->{$array[0]} = $array[1]; } ... add2hash ('fooXbar', \%hash); add2hash ('bishXbash', \%hash);
|
|---|