/\blazy\b(.*?)\bdog\b/ #### while () { if(/\blazy\b(.*?)\bdog\b/) { my $length = length $1; my @words = grep length, split /\W+/, $1; printf "Distance is %d characters, stepping %d words\n", $length, 1+@words; } } __DATA__ The brown fox jumps over the lazy dog The lazy brown fox jumps over the quick dog The lazy fox jumps over the dog The lazy fox dog The fox jumps over the dog...