$ perl -E ' my @strings = qw{ no_data_string /DATA_String/ X/DATA_String/ /some/path/to/DATA_String/ }; say "-" x 40; for my $string (@strings) { say "\$string[$string]"; for my $pos (qw{0 -1}) { say "\$pos[$pos]"; if (index($string, "/DATA_String/") > $pos) { say "index() TRUE"; } else { say "index() FALSE"; } } say "-" x 40; } '