my $str = "this is a test";

my $sub = "is a test"; if ($str =~ /\b$sub\b/) { print "match at char ",@-[0], "\n"; }