I don't see the point. What makes you want to do this?

And if you are changing it, why not make it return the list of matches
in a list context?

        $last = (index $string, $substring)[-1]

(These type of translations/idioms might be candidates for optimization.)

<chaim>

>>>>> "PRL" == Perl6 RFC Librarian <[EMAIL PROTECTED]> writes:

PRL> =head1 ABSTRACT

PRL> This RFC proposes that the C<index> and C<rindex> functions be merged
PRL> and generalized, by adding a fourth parameter to C<index>.

PRL> =head1 DESCRIPTION

PRL> At present C<index> only returns the index of the first occurrence of a
PRL> specified substring. It is proposed that C<index> take a fourth parameter
PRL> telling it which occurrence of a specified substring to locate:

PRL>         $first = index $string, $substring, 0, 1;  # first occurrence
PRL>         $first = index $string, $substring, 0, 2;  # second occurrence
PRL>         $first = index $string, $substring, 0, 3;  # third occurrence

PRL> If omitted, this fourth parameter would default to 1, thus preversing
PRL> the current behaviour.

PRL> The C<rindex> function would be unnecessary, being replaced by:

PRL>         $last = index $string, $substring, -1, -1; # last occurence

-- 
Chaim Frenkel                                        Nonlinear Knowledge, Inc.
[EMAIL PROTECTED]                                               +1-718-236-0183

Reply via email to