Perl6 RFC Librarian <[EMAIL PROTECTED]> writes:
> =head1 DESCRIPTION
> 
> At present C<index> only returns the index of the first occurrence of a
> specified substring. It is proposed that C<index> take a fourth parameter
> telling it which occurrence of a specified substring to locate:
> 
>         $first = index $string, $substring, 0, 1;     # first occurrence
>         $first = index $string, $substring, 0, 2;     # second occurrence
>         $first = index $string, $substring, 0, 3;     # third occurrence
> 
> If omitted, this fourth parameter would default to 1, thus preversing
> the current behaviour.
> 
> The C<rindex> function would be unnecessary, being replaced by:
> 
>         $last = index $string, $substring, -1, -1;    # last occurence

Err... shouldn't that be 

    $last  = index $string, $substring, 0, -1  # last occurrence
    $first = index $string, $substring, -1, -1 # first occurrence found
                                               # in a perverse way

Or am I seeing double negatives where I shouldn't?

-- 
Piers

Reply via email to