in reply to Re: Sort Question (Again) :(
in thread Sort Question (Again) :(

HEY.. I found out why Jeff was coming before Jayne... And my god that can be a loaded answer or question... Anyways...
The problem is Jeff has a space in front of his name... Now how would I say ignore the space in the front of all fields and then sort??


-----------------------
Billy S.
Slinar Hardtail - Guildless
Datal Ephialtes - Guildless
RallosZek.Net Admin/WebMaster
Aerynth.Net Admin/WebMaster

perl -e '$cat = "cat"; if ($cat =~ /\143\x61\x74/) { print "Its a cat! +\n"; } else { print "Thats a dog\n"; } print "\n";'

Replies are listed 'Best First'.
Re: Re: Re: Sort Question (Again) :(
by pixel (Scribe) on Oct 22, 2001 at 12:31 UTC

    Change the split criteria to remove whitespace as well. Building on davorg's code:

    my @sorted_list = map { $_->[0] } sort { $a->[1] cmp $b->[1] or $a->[2] cmp $b->[2] } map { [ $_, (split /\t\s*/)[3,4] ] } @database_in;

    Blessed Be
    The Pixel

Re: Re: Re: Sort Question (Again) :(
by runrig (Abbot) on Oct 19, 2001 at 20:53 UTC
    See answer below.