Question: Create a Perl script to perform the following: a) Create an array listing six of your favorite foods and six of your least liked foods.

Create a Perl script to perform the following:

a) Create an array listing six of your favorite foods and six of your least liked foods.

b) Move the disliked foods to another array.

c) Print out the first three items in the favorite foods array. Include some descriptive text to clarify your output.

d) Ask the user to input another disliked food and append this new item to the array of disliked foods.

e) Move the newly added element to the beginning of the disliked foods array.

f) For the "favorite foods" array, move the value of the first element of the array to become the last element of the same array.

g) Print out the first and last elements of both arrays to show the changes from the previous step. h) Print to the terminal the number of elements in each array with some text

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!