David Nicol Wrote in RFC 262:
>foreach $item (@items){
>#print "$item was at location ",$item:n,"\n";
>print "$item was at location ${item:n}\n";
>};

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]


Reply via email to