learingperl01
MIS
Hello all,
I am trying to figure out how to print a message depending on the number of regexes that were matched...either the count or the number that were matched.
Example
if I am running a initial if statement with 5 regex. Depending on the number of matched regex I would like to print a different message. How can I go about doing that. Right now I have the sample code below which prints the actual regex that was matched, so in addition to printing what is shown below I would like to print at the end the number of the regexes that were matched. So for example if one,two,four matches then I would like to print a total of 3 regex matched.
Thanks in advance for the help.
I am trying to figure out how to print a message depending on the number of regexes that were matched...either the count or the number that were matched.
Example
if I am running a initial if statement with 5 regex. Depending on the number of matched regex I would like to print a different message. How can I go about doing that. Right now I have the sample code below which prints the actual regex that was matched, so in addition to printing what is shown below I would like to print at the end the number of the regexes that were matched. So for example if one,two,four matches then I would like to print a total of 3 regex matched.
Thanks in advance for the help.
Code:
if ( $string_found =~ /one|two|three|four|five/gim ) {
if ( $string_found =~ /one/ ) {
print "One";
}
if ( $string_found =~ /two/ ) {
print "Two";
}