Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Re: Re: Copying a hash to another hash problemby demerphq (Chancellor) |
on Oct 22, 2002 at 16:11 UTC ( [id://207121]=note: print w/replies, xml ) | Need Help?? |
i'm using numeric values for both keys and values Well, this isnt intrinsically a bad thing. But more often than not it is. The reason I say this is because if your indexes are sparse, ie 1, 500,623,7439,104029 or the like, then a hash is a much more suitable container type than an array is. (A hash would store the above usin 5 slots in a hash, an array would store at minimum 104029 elements.) However if the array is dense, 1..9,11..19,21..29 etc then an array is a more suitable approach. (Each slot in a hash is bigger than in an array, so even with the 4 wasted slots in the array would still be much smaller than the 26 allocated slots in the hash.) Also, the difference isnt so much due to what you store in the values, but what you store in the keys. Good luck and dont forget strict. :-)
--- demerphq
In Section
Seekers of Perl Wisdom
|
|