The output of this code (on Perl 5.005, NT) is:use strict; my $b1 = 900000000; my $b2 = 999999999; my $a = 1000000001; print (( $b1 < $b2 ) ? "True\n" : "False\n"); print (( $b1 < $a ) ? "True\n" : "False\n"); print (( $b1 lt $b2 ) ? "True\n" : "False\n"); print (( $b1 lt $a ) ? "True\n" : "False\n");
Which, of course, is obvious for string comparisons. Now, while we all know as good little programmers to avoid using string comparisons when we are comparing numbers, we also know to use more than 2 digits for the year when given plenty of resources. It might be wise to take a look at any mission-critical code and verify that if you are comparing dates that you are doing it numerically. Or even better, consider switching to modules like Date::Manip or Date::Calc that will avoid this type of problem.True True True False
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: The Y2.001775K Bug
by repson (Chaplain) on Apr 19, 2001 at 07:51 UTC | |
|
Re: The Y2.001775K Bug
by Cybercosis (Monk) on Apr 19, 2001 at 06:32 UTC | |
by yakko (Friar) on Apr 19, 2001 at 06:44 UTC | |
by jepri (Parson) on Apr 19, 2001 at 06:44 UTC | |
by Masem (Monsignor) on Apr 19, 2001 at 07:04 UTC |