Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Perl program that allows the user to input a 5-digit nonnegative integer number between 10000 and 99999, separates that number into its individual

Write a Perl program that allows the user to input a 5-digit nonnegative integer number between 10000 and 99999, separates that number into its individual digits and then prints the digits to the screen separated from one another by three spaces each.

If the number entered is not within the range of 10000 and 99999 (inclusive), output an error message that starts with a label of ERROR.

See sample output for examples.

We currently cant test input for being numeric or non-numeric, so assume that all input will be numeric.

Write a Perl program, thinking about the solution in terms of Perl's available functions instead of a solution

you might come up with in C, C++ or Java.

Remember to have #!/usr/bin/env perl as your shebang line.

Remember to use use Modern::Perl; in your program.

Try to follow the Perl Best Practices that weve discussed in class so far

You should only use material presented so far this semester in class, through lecture set of slides #3.

This includes the smart-match operator, relational operators, if conditional statements, the given statement and

Boolean logical operators.

Your error message must start with the label ERROR.

Do not use loops, arrays or the split or substr functions for this assignment.

Make sure to use the use Modern::Perl; statement in your program.

Examples:

Enter a five-digit number: 68182

6 8 1 8 2

Enter a five-digit number: 1234

ERROR: Your number must be in the range 10000 and 99999.

Enter a five-digit number: 01234

ERROR: Your number must be in the range 10000 and 99999.

Enter a five-digit number: 991233

ERROR: Your number must be in the range 10000 and 99999.

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

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

2. How will you handle the situation?

Answered: 1 week ago