http://qs1969.pair.com?node_id=281111


in reply to Sorting Criteria

Aristotle already told what was wrong, so here is a suggestion for your sort method:
sub sorter { "$hashYear{$a}$hashMonth{$a}$hashDay{$a}" <=> "$hashYear{$b}$hashMon +th{$b}$hashDay{$b}" }


T I M T O W T D I

Replies are listed 'Best First'.
Re: Re: Sorting Criteria
by sgifford (Prior) on Aug 05, 2003 at 18:48 UTC
    That will work if days and months are zero-padded. Otherwise, "1/11" will compare equal to "11/1".
      Yeah, silly me
      sub sorter { sprintf"%04d%02d%02d",$hashYear{$a},$hashMonth{$a},$hashDay{$a} <=> sprintf"%04d%02d%02d",$hashYear{$b},$hashMonth{$b},$hashDay{$b} }


      T I M T O W T D I