CIS 2279 Homework Assignment #02

Due Friday, September 16, 2011

All files created must be saved in your class directory /mnt/homes/CLASSES/CIS2279/<username>

  1. Create a perl script named lab02.pl in your user directory. The script must perform the following:
    1. Create an array listing six of your favorite foods.
    2. Create an array listing six foods you dislike.
    3. Print out the first three items in the favorite foods array. Include some descriptive text to clarify your output.
    4. For the "disliked foods" array, move the value of the last element of the array to become the first element of the same array.
    5. Print out the first and last elements of each array to show the changes from the previous step.
    6. Ask the user to add another food to the disliked foods array and then append this new item to the appropriate array.
    7. Print (to the terminal) the last two element of the food array you just appended to confirm the change.

Solution

last updated: 19 Sep 2011 16:43