#! /usr/bin/perl use strict; use warnings; use Time::Local; my $string = 'time: Tue Apr 21 11:50:33 2005'; my $timestamp = get_time($string); print $timestamp,"\n"; sub get_time{  my ($string) = @_;  my %months = (Jan => 0, Feb => 1, Mar => 2, Apr => 3,                May => 4, Jun => 5, Jul => 6, Aug => 7,                Sep => 8, Oct => 9, Nov => 10,Dec => 11,);  my (undef,undef,undef,$mon,$day,$hr,$min,$sec,$year) = split(/[:\s]/,$string);  my $time = timelocal($sec,$min,$hr,$day,$months{$mon},$year-1900);  return $time; }