in reply to
pattern sequence dispersed within text
hello. How about like this ?
use warnings;
use strict;
my $words = 'xxxhexxxxxxxx xle xxnxle nxxx xxnxxx xnxxhexx nxxxxx xlex
+xxxxx nxnx xxxx';
my $string='helen';
print "string=$string\n";
print "words=$words\n";
my @other_stuff = split (/\s+/, $words);
my @pairs = $string =~ /..?/sg;
my $target=$pairs[0];
my $idx=0;
while ($words =~ /(\b\w*?$target\w*?\b)/g ){
print "target=$target,matched=$1\n";
$idx++;
$idx=0 if $idx > $#pairs;
$target = $pairs[$idx];
}