in reply to Regexp Creation
my ($correct, $incorrect) = 0; for(0 .. length($string)-1) { if( substr($string, $_, 1) eq substr($guess, $_, 1) ) { $correct ++; } else { $incorrect ++; } }
There's probably 600 ways to do it without regexes, but I think the only way you'll get a regex to work is with (?{ }) embedded code match thingies, and that's voodoo. I'm not saying it can't be done, but the documentation on them suggests you not use them.
Please see: perlre, for, substr.
-Paul
|
|---|