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
In reply to Re: Palindrome array
by davido
in thread Palindrome array
by rnaeye
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |