title: How do you read the system time and date in Perl?
body: <p>I need to read the system clock (time and date) and display it in a human-readable format in Perl.</p>
  
  <p>Currently, I'm using the following method (which I found <a href="http://perl.about.com/od/perltutorials/a/perllocaltime_2.htm" rel="noreferrer">here</a>):</p>
  
  <pre><code>#!/usr/local/bin/perl
  @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
  @weekDays = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
  ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
  $year = 1900 + $yearOffset;
  $theTime = "$hour:$minute:$second, $weekDays[$dayOfWeek] $months[$month] $dayOfMonth, $year";
  print $theTime; 
  </code></pre>
  
  <blockquote>
    <p>When you run the program, you should see a much more readable date and time like this:</p>
  </blockquote>
  
  <pre><code>9:14:42, Wed Dec 28, 2005 
  </code></pre>
  
  <p>This seems like it's more for illustration than for actual production code.  Is there a more canonical way?</p>