in reply to palindrome using regular expressions

You cannot avoid using (??{ $code }) in a meaningful way. You need recursion, which means you either use (??{ $code }), or (?{ $code }), with the latter solution being more complicated.

Of course, if you don't have to restrict yourself to regexes, it's trivial to avoid (??{ $code }). if ($str eq reverse $str) will do.

  • Comment on Re: palindrome using regular expressions