Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: palindrome using regular expressions

by Anonymous Monk
on Oct 10, 2006 at 11:56 UTC ( #577382=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://577382]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2021-12-02 16:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (23 votes). Check out past polls.

    Notices?