Please forgive my ignorance, but I can't figure out what this is doing.
This routine correctly sorts @lines (array of lines with tab delimited
fields) by column 4.

# Step 3 - assumes columns 3 and 4 contain numeric data
my @sorted = map  { $_->[2] }
             sort { $a->[0] <=> $b->[0] || $a->[1] <=> $b->[1] }
             map  { [ (split /\t/)[3,2], $_ ] }
             @lines;

A couple of quick questions:

1.  How do I do a reverse sort of column 4?
2.  Generally to reproduce a two-key sort, you sort by the secondary key
first, then the primary key.  This assumes that the sorting routine
maintains the order for equal values.  Does the perl sort routine allow for
this?
3.  What does the "->[\d]" do?

TIA.

- B


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to