In general in Perl when you think "unique", think also "hash". If you are dealing with unique entities then you should consider using a hash rather than an array. Often that seems silly bcause the inforamtion you are storing in the hash is really the key rather than the value. However the clean up in the code is very often worth the (memory) overhead of using a hash.
In the case of your pseudo code it looks like a hash is a natural fit in any case. You seem to be mapping from an ID to a name - exactly what a hash's key => value mapping is all about.In reply to Re: Unique elements in an array
by GrandFather
in thread Unique elements in an array
by anne
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |