in reply to text sorting question, kinda

The following will do the sort you want, after the log has been loaded into the array  @v
my @sorted = map { $_->[2] } sort { ($a->[0])*($#v+1) + $a->[1] <=> ($b->[0])*($#v+1) ++ $b->[1] } map { [ !((split '\s+', $v[$_])[2] eq 'blahblah'), $_, $v +[$_] ] } 0 .. $#v;
Later,
Ray.

Replies are listed 'Best First'.
RE: Re: text sorting question
by eak (Monk) on Aug 04, 2000 at 19:43 UTC
    Here is a slightly modified version of the above version, but using an '||' in the 'sort' block to make sure the lines are in the proper order.
    my @sorted = map { $_->[2] } sort{ $b->[0] <=> $a->[0] || $a->[1] <=> $b->[1] } map { [ (split '\s+', $file[$_])[2] eq 'blahblah', $_, $f +ile[$_] ] } 0 .. $#file;