garymgordon
Programmer
I have the following that I am using in order to find as many matches as possible and then print out the number of matches found, and which letters were found in the match.
Here is what I have:
$letters5 = "AARON FOOBARR SMITTH";
if( $letters5 =~ m/\w*(.)\1\w*/g ){
print "\n";
print "matched $&\n";
print "1 = $1\n";
print "\n\n";
}
But, I get the same result with or without the /g at the end. I am trying to figure out how to have the match (maybe re-written) so it will not only match the first set of double letters - but as many as it can find. Then, print out for me the total number of matches found, and which words contained the matches ... and which letters were matched.
Help ... please?
Thanks,
Gary
PS: What am I doing wrong here?
Here is what I have:
$letters5 = "AARON FOOBARR SMITTH";
if( $letters5 =~ m/\w*(.)\1\w*/g ){
print "\n";
print "matched $&\n";
print "1 = $1\n";
print "\n\n";
}
But, I get the same result with or without the /g at the end. I am trying to figure out how to have the match (maybe re-written) so it will not only match the first set of double letters - but as many as it can find. Then, print out for me the total number of matches found, and which words contained the matches ... and which letters were matched.
Help ... please?
Thanks,
Gary
PS: What am I doing wrong here?