in reply to Can you scan an @array for a fragment of data?

You have three basic options:
  1. Iterate through the array, checking each element in turn. Don't use this method if you'll need to scan the array more than once or twice.
  2. Use grep. Good option if you only want to check part of each element.
  3. Turn your array into a hash. Use this method if you'd otherwise be using option #1 often.
This is a Categorized Q&A, so see How to find out if X is an element in an array?.
  • Comment on Re: Can you scan an @array for a fragment of data?