rindex
Finds the last occurrence of a substring within a string.
Searches STRING for the last occurrence of SUBSTR, considering only matches that start at or before character position END (default: end of string). Returns the zero-based character position of the match, or -1 if the substring is not found.
For an empty SUBSTR, returns min(END, length(STRING)) to match
perl5 behaviour.
Positions are in characters (not bytes), so this works correctly with
multi-byte UTF-8 strings. An ASCII fast path uses rfind directly
when both operands are pure ASCII.
When the OPpTARGET_MY flag (0x10) is set, the result is stored
directly into the pad slot rather than pushed to the stack.
Synopsis
$pos = rindex($string, $substr);
$pos = rindex($string, $substr, $end);