http://www.perlmonks.org?node_id=577368

szabgab has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to understand how Regexp::Common finds palindromes. I took out the code from the module that looks like this:
use re 'eval'; my $ch = '[a-zA-Z]'; my $palindrome; my $r = "(??{\$palindrome})"; $palindrome = qr/$ch|($ch)($r)?\1/; while (<>) { print if /^$palindrome$/; }
Would someone care to exmplain how it works? Are there other solutions not using (??{ code }) ?