index
Finds the first occurrence of a substring within a string.
Searches STRING for the first occurrence of SUBSTR starting at character position START (default 0). Returns the zero-based character position of the match, or -1 if the substring is not found.
Positions are in characters (not bytes), so this works correctly with multi-byte UTF-8 strings. An ASCII fast path avoids the overhead of character-index conversion 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 = index($string, $substr);
$pos = index($string, $substr, $start);