in reply to Sorting Data by Date

I am keeping with you approach of sorting strings using lexicographic order and I am supposing that you know how to parse the dates. You need to use the format %02s in sprintf so that the first day of the week and the first month of the year are represented with 2 digits. You can use a subroutine like date2str below and sort the resulting strings.
sub date2str { my ( $month, $day, $year, $rest } = @_; sprintf( "%04d%02d%02d%s", $year, $month, $day, $rest ); }

-- stefp

Replies are listed 'Best First'.
Re: Re: Sorting Data by Date
by lex2001 (Sexton) on Sep 08, 2001 at 00:16 UTC
    thanks for the reply. With your above code -- would this process the "|" data in the flat db file? If so it doesn't look like it's taking that into account. Also right now I just have one field for entering the date - I could seperate them out to different fields -- each with it's own scalar value. In addition when you say $rest do you mean the rest of the data in the "|" db file?