examples/index.pl

use strict;
use warnings;
use 5.010;

my $str = "The black cat climbed the green tree";

say index $str, 'cat';             # 10
say index $str, 'dog';             # -1
say index $str, "The";             # 0
say index $str, "the";             # 22

It will search for the location of the second string in the first string. Returns -1 in case the string could not find the second string. You can also add a 3rd parameter that will tell index where to start the serach from.

It is like the rindex function but starts searching from the left-hand side of the string. See also the explanation in String functions: length, lc, uc, index, substr.

documentation.