Hi acrobat118,
Here's a rough outline of what you'll need:
- Read a file and loop over its lines: "Files and I/O" in perlintro (also covers how to write to an output file)
- Act only on lines that match a pattern (grep): "Regular expressions" in perlintro
- Break a line into columns (awk): split, e.g. my @F = split; splits the current line $_ on whitespace; the first column is then $F[0], second column $F[1], etc.
- Operate only on lines that match certain conditions (awk): "Conditional and looping constructs" in perlintro and the section following it "Builtin operators and functions"
- Adding the resulting items to an array: push (for a more advanced approach see "arrays of arrays" in perldsc)
- Sorting the array: sort and "How do I sort an array by (anything)?" in perlfaq4
Try using this information to write some code, and if you run into trouble feel free to ask here.
Hope this helps,
-- Hauke D
Update: Expanded post slightly.