title: How can I convert of the unix date output across multiple time zones to UTC, in Perl?
body: <p>In Perl, how would one efficiently parse the output of unix's date command, taking into account time zone, and also convert to UTC?</p>
  
  <p>I've read many similar questions on stackoverflow, but few seem to take into account parsing multiple time zones.  Instead they seem to set the timezone manually and assume it to stay fixed.</p>
  
  <pre><code># Example Input Strings:
  my @inputs = (
                'Tue Oct 12 06:31:48 EDT 2010',
                'Tue Oct 12 07:49:54 BST 2010',
               );
  </code></pre>
  
  <p>I tried the following to no avail:</p>
  
  <pre><code>foreach my $input ( @inputs ) {
    my $t = Time::Piece-&gt;strptime( $input,
                                   '%a %b %d %T %Z %Y' );
    print $t-&gt;cdate, "\n";
  }
  </code></pre>
  
  <p>It seems the problem is the time zone (%Z).  Additionally, a time zone field does not seem to exist in Time::Piece, which would require me to write custom code to convert to UTC, which just seems... wrong.</p>
  
  <p>Context:
  I'm attempting to parse legacy logs from a variety of sources that use the unix date command for timestamps.  Ideally, I'd like to convert all timestamps to UTC.</p>
  
  <p>Any help would be greatly appreciated.</p>