Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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

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 drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2016-09-25 18:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (470 votes). Check out past polls.