CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [Laurent_R] Problem on Palindrome: Edit Log



iammgg
Novice

May 25, 2017, 6:52 PM


Views: 1509
Re: [Laurent_R] Problem on Palindrome

Thanks so much for the response. I tried the lc function and it works.

Here is my new code.


Code
 if(lc ($string) eq reverse lc ($string)) { 
print "The word $string is a palindrome.\n";
}

else {
print "The word $string is not a palindrome.\n";
}


and the output now is


Code
$ ./3.4_Palindrome.pl 
Input a string: Racecar
The word Racecar is a palindrome.

$ ./3.4_Palindrome.pl
Input a string: hello
The word hello is not a palindrome.


Thanks again!


(This post was edited by iammgg on May 25, 2017, 6:55 PM)


Edit Log:
Post edited by iammgg (Novice) on May 25, 2017, 6:55 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives