use warnings; use strict; my $s = 'CATALOG SCATTER CAT CATHARSIS'; my $k = 'CAT'; if ($s =~ /\b$k\b/g) { print "match started at position ", (pos($s) - length($k)), "\n"; } __END__ match started at position 16