Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Needs to be done in Perl please and thank you!!! A palindrome is a number or a text phrase that reads the same backwards as

Needs to be done in Perl please and thank you!!!

image text in transcribedimage text in transcribedimage text in transcribed

A palindrome is a number or a text phrase that reads the same backwards as it does forwards. For example, each of the following seven-digit integers is a palindrome: , and . Each of the following seven-character strings is a palindrome: Write a program that reads in a seven-character stringumber and determines whether or not it is a palindrome. It should print or based on whether or not it is, indeed, a palindrome or not If the input is not 7 characters long, output an error message labeled with and don't attempt to process the value. Goals - Write a Perl program, keeping in mind different ways to test string and numeric equality. - Even though one of the philosophies of Perl is TMTOWTDI, you can only use material covered through lecture \#4 to solve this assignment. Points to Think About - Think about how you can test different types of input, including string/character data and numeric data. - For this program, you can't use the function, which over-trivializes the solution. We're focusing on practicing with all of the tools available in Perl, so you're being guided to make this solution a bit more complex than it could be. :) - Remember to have as the very first line of your program to use the appropriate version of Perl on the system (installed with - Use in your program. - Try to follow the Perl Best Practices that we've discussed in class so far. Grading Notes - You must have a signed Honor Pledge on file for this assignment to be graded. - You should only use material presented so far this semester in class, through lecture \#4. - Output the phrases OR exactly on a separate line from the input. - Do not use arrays or other libraries for this program. - Make sure to use the in your program. - You may not use the function, which reduces the solution to the incredibly simple: if ( \$original eq reverse \$original) \{ say "PALINDROME!"; \} Sample Run Enter in a 7 character phrase: 1111111 PALINDROME Enter in a 7 character phrase: 1234522 NOT Sample Run Sample Run Enter in a 7 character phrase: 1234567 NOT Sample Run Enter in a 7 character phrase: 123 ERROR: That is not a 7-character input. Sample Run Enter in a 7 character phrase: 12345678 ERROR: That is not a 7-character input

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions