*starts = \@-; *ends = \@+; our (@starts, @ends); my $str = 'Hulk hate classless system with means of manufacturing given to working class! Hulk crush puny Marxists!'; if ($str =~ /with means of \w+/) { print "\$-[0] <$-[0]> \$+[0] <$+[0]>\n"; my $word = substr $str, $starts[0] + 14, $ends[0] - $starts[0] - 14; print "word <$word>\n"; } __END__ $-[0] <27> $+[0] <54> word