LostS has asked for the wisdom of the Perl Monks concerning the following question:
OK Guys here is the issue...
I have a flatfile DB type thing going on... it is a tab delimited file. The row I am trying to sort on is the 5 section.
It is a time such as 9:00 AM or 2:00 PM... Now I need to list this in chronological (spelling) order...
so it will look like this:
9:00 AM
10:00 AM
2:00 PM
9:00 PM
This is my current sort code:
This is fine however it lists it in numercial order only so 1:00 AM 2:00 PM 9:00 AM How can I make this so it displays it correctly?? Also I need to make it so that in case the user who filles out my form puts the time in as say 09:00 AM it will still list it in the correct position... Thanks :)foreach $_ (sort { (split /\t/, $a)[4] cmp (split /\t/, $b)[4] } @data +base_in) { ..... }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Sorting Issues :(
by Masem (Monsignor) on Jul 18, 2001 at 21:28 UTC | |
by LostS (Friar) on Jul 18, 2001 at 21:52 UTC | |
by petdance (Parson) on Jul 19, 2001 at 05:27 UTC | |
by Masem (Monsignor) on Jul 18, 2001 at 21:55 UTC | |
by LostS (Friar) on Jul 18, 2001 at 21:59 UTC | |
by Hofmator (Curate) on Jul 18, 2001 at 22:04 UTC | |
by LostS (Friar) on Jul 18, 2001 at 22:24 UTC |
Back to
Seekers of Perl Wisdom