Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Palindrome array

by davido (Archbishop)
on Dec 29, 2012 at 09:47 UTC ( #1010807=note: print w/ replies, xml ) Need Help??


in reply to Palindrome array

There are a number of good ways to approach this. Here's one way that uses a CPAN module:

use String::Palindrome qw( is_palindrome ); my @array = qw( x a m a x ); print "@array ", is_palindrome( @array ) ? "is" : "isn't ", "palindromic.\n";

The above solution works just as well if you pass it a string rather than an array, but in either case it does the job.


Dave


Comment on Re: Palindrome array
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2014-07-10 03:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (198 votes), past polls