in reply to Determing the indice of an array

Sure, one way is to create a "reverse lookup" hash via a hash slice:
my @item = qw(foo bar baz qux); my %lookup = (); @lookup{@item} = (0..$#item); # lookup stuff my $index = $lookup{baz}; print $item[$index], "\n";

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re: (jeffa) Re: Determing the indice of an array
by Anonymous Monk on Mar 10, 2003 at 21:51 UTC
    That worked perfectly
    Thanks