http://www.perlmonks.org?node_id=97774
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:
foreach $_ (sort { (split /\t/, $a)[4] cmp (split /\t/, $b)[4] } @data +base_in) { ..... }
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 :)