IvorW has asked for the wisdom of the Perl Monks concerning the following question:
foreach (keys %a)
{
$b{$_} = $a{$_};
}
While this works, I wondered if there was a better way. I know the equivalent with arrays is easy.
@b = (@b,@a);
This might become significant for performance if one or other hash is not a real hash, but is tied to something.
Any thoughts?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Union of hashes
by Biker (Priest) on Feb 07, 2002 at 11:07 UTC | |
by gellyfish (Monsignor) on Feb 07, 2002 at 12:00 UTC | |
by AidanLee (Chaplain) on Feb 07, 2002 at 13:18 UTC | |
by Masem (Monsignor) on Feb 07, 2002 at 14:37 UTC | |
|
Re: Union of hashes
by trs80 (Priest) on Feb 07, 2002 at 20:50 UTC | |
|
Re: Union of hashes
by ropey (Hermit) on Feb 07, 2002 at 16:24 UTC | |
by merlyn (Sage) on Feb 07, 2002 at 16:43 UTC | |
by jcwren (Prior) on Feb 07, 2002 at 17:50 UTC |