title: In Perl, how can I check if a number is an element of an array?
body: <p>I'd like to write a short Perl prg that has 1 parameter (a 3 digit integer) passed to it, and depending which list it's a member of it returns the corresponding list's number. How can I achieve this, also is there any way to put a range of number as an element in a list ?</p>
  
  <pre><code> ::Returns 1,2,3,4 Depending on testNum passed
   @gp1= (829,845,851,859,864,867);
   @gp2= ("826-828","830-839","843-844","847-850","852-854","860-862","883");
   @gp3= ("855-858",861,"863","865");
   @gp4= ("877-882",884);
  
   if ( ($ARGV[0]&gt;=822 &amp;&amp; $ARGV[0] &lt;=824) || $ARGV[0]  is membergp1)
   {  
    return 1
   }
    if ( $ARGV[0]&gt;=826 &amp;&amp; $ARGV[0]&lt;=828 || $ARGV[0] is memebr of group2
      return 2
    if $ARGV[0] is memebr of group3
        return 3
    if $ARGV[0] is memebr of group4
        return 4
  </code></pre>