Gurus,
I'm unable to find this in the Camel, Panther, or Billygoat books, so I'll
ask you... Is there a Perl function that returns the index of a given
element in an array? For example:
my @list = q( apple banana pear grapefruit);
my $look4 = "banana";
my $ndx = somefunc( $look4, @list ); # sets $ndx to 1
$look4 = "monkeywrench";
$ndx = somefunc( $look4, @list); # sets $ndx to -1, or maybe undef?
I'm trying to find a more elegant way than running a foreach loop over
@list.
Thanks!
Deane Rothenmaier
Programmer/Analyst
Walgreens Corp.
847-914-5150
A word to the wise ain't necessary, it's the stupid ones who need the
advice. -- Bill Cosby
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs