in reply to Time transformation

Everyone told you how to do it right, but no one told you what you were doing wrong.
my $xcltime = "19:45:34"; # It should print 7:45 PM my $xcltime2 = "23:35:14"; # It should print 11:35 PM if (($xcltime =~ /(\d{1,2}):(\d{1,2}):(\d{1,2})/) || ($xcltime2 =~ /(\ +d{1,2}):(\d{1,2}):(\d{1,2})/)) {
You should probably do a loop over both $xcltime and $xcltime2, to make sure BOTH of them get the treatment.
my $h1=$1;my $m2=$2; my $s3=$3; if ($h1 =~ /13||14||15||16||17||18||19||20||21||22||23||24/) {
You're confusing Perl's "OR" operator || with the regex's alternation symbol |. When you use a||b in a regex, you're saying "match 'a' or nothing or 'b'".

There's also no point in saying "if $str matches /foo/, substitute 'bar' for /foo/". Just say "substitute 'bar' for /foo/", and if any matches are found, they'll be changed. The idiom s/a/b/ if /a/ is pointless.

$h1=~s/13/1/; $h1=~s/14/2/; $h1=~s/15/3/; $h1=~s/16/4/; $h1=~s/17/5/; $h1=~s/18/6/; $h1=~s/19/7/; $h1=~s/20/8/; $h1=~s/21/9/; $h1=~s/22/10/; $h1=~s/23/11/; $h1=~s/24/12/;
And there's no reason to use regexes here. $h1 is just a number now. This logic should be written as
my $pm = 0; # assume AM if ($h1 > 12) { $pm = 1; $h1 -= 12; }
_____________________________________________________
Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart