in reply to Perl Palindrome

G'day hushbaby,

Welcome to the monastery.

You just need a single variable to capture user input.

Use length if you need to check the number of characters entered.

Use reverse to check for a palindrome.

Here's the guts of what you want:

#!/usr/bin/env perl use strict; use warnings; print 'Enter string: '; chomp(my $string = <>); print $string eq reverse($string) ? 'Yes' : 'No', "\n";

Sample runs:

Enter string: 123 No
Enter string: 121 Yes

I'll leave you to flesh that out for your homework(?).

-- Ken