my $haystack = "foobar"; my $needle = "Bar"; $haystack =~ /($needle)/gi; print ((pos $haystack) - (length $needle));