in reply to Perl Palindrome

I would suggest looking at split() and reverse(), to make your project somewhat easier.

$ perl -Mstrict -Mwarnings -le 'print qq{Enter a 9-character line:}; m +y $line = <>; chomp $line; if ( $line eq reverse $line ) { print q{ye +s}; } else { print q{no}; }' Enter a 9-character line: 123456789 no $ perl -Mstrict -Mwarnings -le 'print qq{Enter a 9-character line:}; m +y $line = <>; chomp $line; if ( $line eq reverse $line ) { print q{ye +s}; } else { print q{no}; }' Enter a 9-character line: 123454321 yes

Hope that helps.

Replies are listed 'Best First'.
Re^2: Perl Palindrome
by Anonymous Monk on Apr 16, 2014 at 00:07 UTC
    Is there a way of doing the required action without the usage of reverse or split however...

      Is there a way of doing the required action without the usage of reverse or split however...

      I'll tell you when your test/interview/homework deadline has passed