$_= "11:12AM"; tr/://d; if (s/(\d\d)(\d\d?)([A|P])M/$1$2/) { if ($3 eq "P") {$_ +=1200 unless $1==12}; } print $_;