NAME
String::Palindrome - Determine if a string is a palindrome
VERSION
version 1.02
SYNOPSIS
use String::Palindrome qw/ is_palindrome /;
# Simple strings
my $is = 'abccba';
my $is_not = 'abcdef';
is_palindrome( $is ); # 1
is_palindrome( $is_not ); # 0
is_palindrome( {a => 1} ); # undef
is_palindrome( ); # undef
# Arrays
my @is = qw/ a ab cc ab a /;
my @is_not = qw/ a ab cc a ba /;
is_palindrome( @is ); # 1
is_palindrome( \@is ); # 1
is_palindrome( @is_not ); # 0
is_palindrome( \@is_not ); # 0
is_palindrome( [] ); # undef
EXPORTS
is_palindrome
FUNCTIONS
is_palindrome
Returns true if the string, array_ref, or array is a palindrome. If more than one parameter is passed to the function, then it will blindly assume that you want to treat them as an array to be tested. This means that you could, theoretically, pass in a palindrome of array_refs and it would still pass.
If only one arg is passed, then it is first checked to see if it is an array ref. If it is an array ref it is treated as a normal array. If it is a simple scalar, then it is treated as a string. If it is any other type of ref, then undef is returned. Additionally, a blank array ref also returns undef.
AUTHOR
Adam Lesperance <lespea@gmail.com>
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc String::Palindrome
Websites
Search CPAN
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
CPAN Forum
RT: CPAN's Bug Tracker
CPANTS Kwalitee
CPAN Testers Results
CPAN Testers Matrix
Source Code Repository
The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)
Bugs
Please report any bugs or feature requests to bug-string-palindrome at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=String-Palindrome. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Adam Lesperance.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.