Webmaster wrote:
> What would really be nice here is an C<index> function, similar to the
> scalar version, that returns the index of the matching entry in a list. For
> instance:
>
> my $n=0;
> foreach (@items){
> print "Found It at position $n!\n" if /$seek/;
> $n++;
> }
> Could be replaced by:
> if (my $n = arrindex( @items, $seek )) {
> print "Found It at position $n!\n" ;
> }
> Grant M.
> [EMAIL PROTECTED]
Yes, that is exactly what is being suggested, but the "indexof" function
is implicit in the attribute. Your code becomes
print "Found It at position ${_:n}!\n" if /$seek/ foreach @items
--
David Nicol 816.235.1187 [EMAIL PROTECTED]
"A taste so good that we stand behind every bottle and can."