Perl

Menu

In-Class Assignment #2

This assignment will test your understanding of the sort function, as discussed in today's class.

I have already written the framework for you. Copy the file ~lallip/public_html/ica2.pl to your local directory to begin modifying it.

You must write two chunks of code, to print out two lists, sorted in different manners. The first is an array of numbers. Print them out in descending numeric order. You are not permitted to use the reverse function. The second is an array of words. Print them out in a case insensitive ascending alphabetical order.

For a bonus half point, take the hash at the bottom of the framework and print out a list of its key-value pairs, sorted by the *values* of the hash. (No partial credit will be awarded for the bonus. It must work 100% correctly)

Sample Output

In descending numeric order, the numbers 5, 8, 4, -5, 3.1, 0, 18 are:
18, 8, 5, 4, 3.1, 0, -5


In ascending alphabetical order (ignoring case), hello, Hola, Paul, peter, jeffrey, hillary, Jennifer are:
hello, hillary, Hola, jeffrey, Jennifer, Paul, peter


Hardwick, Martin teaches Computer Science I
Hollinger, Dave teaches Computer Organization
Hollinger, Dave teaches Operating Systems
Lalli, Paul teaches Programming in Perl
Mehta, Alok teaches Programming in Java
Stewart, Chuck teaches Computer Science II

Submission

Your program must run on rcs-sun4.rpi.edu using Perl 5.8. When you are ready to submit, execute the program ~lallip/public/ic_submit.pl and follow the prompts.

This program must be submitted by 6:00pm today, Wednesday September 14

Perl Quotes
Perl Quotes