Home > Articles > Web Development > Perl

  • Print
  • + Share This
This chapter is from the book


  1. Can you suggest a quick way to find a particular string in an array element?

  1. Iterating over the array and checking each element are the usual ways to do so. If you frequently find yourself searching an array to see whether an element is in the array, you probably didn't want to store the data in an array in the first place. A much more efficient structure for random-element access is a hash, which is covered in Hour 7.

  1. How can I eliminate duplicate elements from an array?

  2. How can I count the number of unique elements in an array?

    How can I see whether two arrays contain the same or different elements?

  1. The answer to all these questions is the same: Use a hash. Hashes allow you to do some rather interesting manipulations on arrays quickly and efficiently. All these questions are answered in Hour 7.

  • + Share This
  • 🔖 Save To Your Account