#!/usr/bin/perl use Modern::Perl; # This does a Palindrome verification in Perl using a loop. # Limit is set to 7 characters, but could easily be updated for any length string print "Enter in a 7 character item: "; my $input = <>; chomp $input; my $cat = $input; my $count = 0; my $reverse; my $last; while ($count <8) { $last = chop $input; $reverse .= $last; $count++; } if ($cat eq $reverse) { say "PALINDROME!"; } else { say "NOT A PALINDROME!"; }