A Date of Infamy was originally published on January 11, 2006


Without many of the built-in date/time functions found in other languages, some Perl users can find themselves having to write some interesting code in order to get the results they want. Sure, it's pretty easy to reference the DateTime module, or a whole host of other modules to help with this, but who wants to use code that someone else invented? Some resort to fiddling with the number of seconds since epoch returned by the time() function. Others, such as Mike's predecessor, issue an operating system command to write the date out to text file, read the file back in, parse it, and use the result ...

#write out date
system("date >/tmp/the.date");

#read it back in
open(THEDATE, "</tmp/the.date");
while (<THEDATE>) 
{
  chop;
  @datevals = split(/ /,$_);
}
close(THEDATE);
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!