in reply to Date comparison Y2K problem

You can set an arbitrary limit, for example 30. Everything below that is interpreted as a 20XX date, everything above that as a 19XX date.
$year += 100 if $year < 30;

Then just compare by number.

Replies are listed 'Best First'.
Re^2: Date comparison Y2K problem
by Anonymous Monk on Apr 15, 2008 at 19:54 UTC
    yeah similar stategy we are thinking to follow but we have also planned to convert these dates into 4 digit year dates .. is there any posibilities
      Of course!

      Just read your files record by record and write them out again with the dates suitably made Y2K compliant. Then you can use these new files without problems.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      moritz actually means 1900 so something like:

      sub fixY2K { my $date = shift; return $date if $date > 1900; return $date + 1900 if $date > 30; warn "Assuming '$date' means 20$date!\n"; return $date + 2000; }