Date: Tue, 03 Jul 2001 19:07:50 GMT
From: iowa_song88.remove_eights_and_this@hotmail.com (Weston Cann)
Subject: Finding the subscript of an item in an array...
Message-Id: <iowa_song88.remove_eights_and_this-0307011315220001@55.westvalleycity-01rh15rt-ut.dial-access.att.net>

I know that you can find the subscript of an item in an array by
doing something like this:


my @foo = ('Travis','Bonnie','Flipper','Arnold','Deluxe');
my $item = 'Flipper';

my $index = 0;
my $subscript;

while($index <= $#foo)
{
   if($item eq $foo[$index])
   { $subscript = $index; }

   $index++;
}



This is OK, but it's sortof bulky. I'm wondering if there's a neat-o
perl idiom/single line kind of way to do the same thing.


