sub my_format_to_iso8601 {
$_[0] =~ /(\d\d):(\d\d):(\d\d), (\d\d)\/(\d\d)\/(\d\d\d\d)/;
return "$6-$4-$5T$1:$2:$3";
}
$date1 = "11:56:41, 11/22/2011";
$date2 = "11:20:41, 11/20/2011";
$d1 = my_format_to_iso8601($date1);
$d2 = my_format_to_iso8601($date2);
print "first is $d1\n";
print "second is $d2\n";
if($d2 < $d1) {
print "second is earlier\n";
} else {
print "first is earlier\n";
}