Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 examining the Monastery: (12)
As of 2015-08-03 18:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (48 votes), past polls