in reply to Re: Simple things should be coded simply (Re: Idiomatic Array Index Search?)
in thread Idiomatic Array Index Search?

Then grep() would be a super choice:
sub get_index { my ($a, $e) = @_; my @idx = grep $a->[$_] eq $e, 0 .. $#$a; return wantarray ? @idx : $idx[0]; }


japhy -- Perl and Regex Hacker
  • Comment on Re: Re: Simple things should be coded simply (Re: Idiomatic Array Index Search?)
  • Download Code