[an error occurred while processing this directive]

Perl

Menu

In-Class Assignment #2

For this ICA, you will work with the sort function we learned in class today, and gain experience sorting on different criteria

Copy or download the file ~lallip/public/ica2.pl to your home directory. This file forms the skeleton of your submision.
Edit this file to fill in the various sorts listed. For full credit, you must:

  • Sort the list of strings alphabetically. That is, without regard to case. 'Apple' comes before 'banana', which comes before 'Carot'.
  • Sort the list of files based on their size. Smallest files come first.
  • Sort the list of strings by their length. Largest strings come first.

For a bonus 0.5 points, complete the final sort as well. Sort the strings based on the first position of the letter 'a'. Strings that have 'a' earlier come before those that have it later. Strings that don't have 'a' at all come first. If two strings have 'a' in the same position, sort them by their length (smallest first). If they have 'a' in the same position and the same length, sort them ASCIIbetically.

Sample I/O

If you run your program and provide the following command line arguments:
Canteen alpha dictionary fantasy Enough bad
You should receive the following output:

Strings sorted alphabetically: alpha bad Canteen dictionary Enough fantasy

Files sorted smallest to largest: 
two.txt
four.txt
one.txt
three.txt

Strings sorted by length: dictionary Canteen fantasy Enough alpha bad

Strings sorted by position of 'a', length, and ASCIIbetically: Enough alpha bad Canteen fantasy dictionary

Submission Instructions

To submit this program, execute ~lallip/public/submit.pl on either rcs-sun4.rpi.edu or solaris.remote.cs.rpi.edu. Note that if you use the CS version, you will be prompted to enter 'DONE' after typing the name of your file, as this script is set up for future assignments with multiple files.

I request that everyone begin using their CS accounts unless you've not yet recived your reset password from labstaff. Starting next week, the RCS submission script will be disabled.

You may submit infinite times, only the last submission is graded. Your final submission is due at the end of class today, 4pm, Thursday, February 11, 2010

Perl Quotes
Perl Quotes