Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Re: best data structureby fruiture (Curate) |
on Aug 28, 2002 at 14:29 UTC ( [id://193468]=note: print w/replies, xml ) | Need Help?? |
grep will work for this, but it's not a good solution to check for an existing item, especially not via regexp, because it will always iterate over the whole list, even if the elemet is fond at the first position. So first thought would be a hash again, withe code like that:
That may work in special cases, but `perldoc -f each` tells us not to change a hash while iterating over it, so we end up doing it like that:
An that works. http://fruiture.de
In Section
Seekers of Perl Wisdom
|
|