Do the Schwartzian boogy! or here is a typical multifield sort.
#!/usr/bin/perl -w use strict; my @data; while (<DATA>){ my @dataline = split (/\s+/,$_); print "@dataline\n"; push(@data,\@dataline) } print "\n@data\n\n"; &printarray(\@data); print "\n"; my @data_sorted_by_four_fields = sort { $a->[2] <=> $b->[2] || $a->[0] <=> $b->[0] || $a->[4] <=> $b->[4] || $a->[1] cmp $b->[1] } @data; &printarray( \@data_sorted_by_four_fields ); print "\n"; ###########################################3 # Print the contents of the array sub printarray { my $aref=shift; foreach my $record (@$aref) { for my $i (0..4) { print $record->[$i] . " "; } print "\n"; } } ############################################# __DATA__ 1040564312 z 89 Out 4194077715 1040564322 w 90 Out 4194081727 1040564335 x 94 IN 4194085256 1040564335 y 94 Out 4194085196 1040564312 z 89 In 258381720 1040564322 z 90 In 258385268

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to Re: Date Array Convolution by zentara
in thread Date Array Convolution by alanonymous

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.