Would someone care to exmplain how it works? Are there other solutions not using (??{ code }) ?use re 'eval'; my $ch = '[a-zA-Z]'; my $palindrome; my $r = "(??{\$palindrome})"; $palindrome = qr/$ch|($ch)($r)?\1/; while (<>) { print if /^$palindrome$/; }
In reply to palindrome using regular expressions by szabgab
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |