Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: check if an element exists in arrayby GrandFather (Saint) |
on Apr 19, 2008 at 08:56 UTC ( [id://681632]=note: print w/replies, xml ) | Need Help?? |
For focused advice you need to give us the bigger picture. If the search is occasional or the array is small (supply your own definition for both those) then grep is the tool of choice. If you don't care about the original order of the data and the data set is of modest size (again supply your own definition) then a hash of arrays may be appropriate. If the data size is modest (ditto) but you need order information add an ordinal along with the data value for each item (see below). If the data is large, use a database. For the penultimate option consider:
Prints:
Perl is environmentally friendly - it saves trees
In Section
Seekers of Perl Wisdom
|
|