| 1 | The following information about Perl and the year 2000 is a modified |
| 2 | version of the information that can be found in the Frequently Asked |
| 3 | Question (FAQ) documents. |
| 4 | |
| 5 | Does Perl have a year 2000 problem? Is Perl Y2K compliant? |
| 6 | |
| 7 | Short answer: No, Perl does not have a year 2000 problem. Yes, |
| 8 | Perl is Y2K compliant (whatever that means). The |
| 9 | programmers you've hired to use it, however, probably are |
| 10 | not. If you want perl to complain when your programmers |
| 11 | create programs with certain types of possible year 2000 |
| 12 | problems, a build option allows you to turn on warnings. |
| 13 | |
| 14 | Long answer: The question belies a true understanding of the |
| 15 | issue. Perl is just as Y2K compliant as your pencil |
| 16 | --no more, and no less. Can you use your pencil to write |
| 17 | a non-Y2K-compliant memo? Of course you can. Is that |
| 18 | the pencil's fault? Of course it isn't. |
| 19 | |
| 20 | The date and time functions supplied with perl (gmtime and |
| 21 | localtime) supply adequate information to determine the |
| 22 | year well beyond 2000 (2038 is when trouble strikes for |
| 23 | 32-bit machines). The year returned by these functions |
| 24 | when used in a list context is the year minus 1900. For |
| 25 | years between 1910 and 1999 this happens to be a 2-digit |
| 26 | decimal number. To avoid the year 2000 problem simply do |
| 27 | not treat the year as a 2-digit number. It isn't. |
| 28 | |
| 29 | When gmtime() and localtime() are used in scalar context |
| 30 | they return a timestamp string that contains a fully- |
| 31 | expanded year. For example, $timestamp = |
| 32 | gmtime(1005613200) sets $timestamp to "Tue Nov 13 01:00:00 |
| 33 | 2001". There's no year 2000 problem here. |
| 34 | |
| 35 | That doesn't mean that Perl can't be used to create non- |
| 36 | Y2K compliant programs. It can. But so can your pencil. |
| 37 | It's the fault of the user, not the language. At the risk |
| 38 | of inflaming the NRA: ``Perl doesn't break Y2K, people |
| 39 | do.'' See http://language.perl.com/news/y2k.html for a |
| 40 | longer exposition. |
| 41 | |
| 42 | If you want perl to warn you when it sees a program which |
| 43 | catenates a number with the string "19" -- a common |
| 44 | indication of a year 2000 problem -- build perl using the |
| 45 | Configure option "-Accflags=-DPERL_Y2KWARN". |
| 46 | (See the file INSTALL for more information about building |
| 47 | perl.) |