My brain must be short circuited!!
A test run:
How can it not find the match???
Please help to modify $string and keep the regexp so that a match is guaranteed.
[Note] I got this regexp from another place. I just want to construct a string to make "if ($string = m/trunk\.codeanalysis\.([a-z]+)/)" block work.
Thanks!
Code:
$string = 'trunk.codeanalysis.test';
print "\$string = $string\n";
if ($string = m/trunk\.codeanalysis\.([a-z]+)/) {
$suffix = $1;
print "Match - #$suffix#\n";
} else {
print "No match!!\n";
}
exit 0;
A test run:
Code:
% ./test.pl
$string = trunk.codeanalysis.test
No match!!
How can it not find the match???
Please help to modify $string and keep the regexp so that a match is guaranteed.
[Note] I got this regexp from another place. I just want to construct a string to make "if ($string = m/trunk\.codeanalysis\.([a-z]+)/)" block work.
Thanks!