in reply to Merge 2 or more logs, sort by date & time

Thank you everyone for the help so far. Unfortunately, it's not working properly. Here is my code now:
my $log = $provoutfile; print "Now Processing $log....\n"; open LOG, "$log" or die "LOG $log: $!\n"; $linecnt = 0; while (<LOG>) { chomp $_; $linecnt++; my @sortedlines = map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [$_, Time::Piece->strptime($_, '%a %b %d %H:%M:%S %Y')-> +epoch ] } @lines; $line = ""; $linecnt = 0; }
It doesn't fail or error or anything... it just doesn't sort properly. When I grep TIMESTAMP out of my output file, the last dozen-ish lines look like this:
TIMESTAMP=Fri Nov 2 16:33:18 2018 TIMESTAMP=Fri Nov 2 17:26:35 2018 TIMESTAMP=Fri Nov 2 17:26:35 2018 TIMESTAMP=Fri Nov 2 17:27:33 2018 TIMESTAMP=Fri Nov 2 17:27:33 2018 TIMESTAMP=Thu Oct 18 18:29:15 2018 TIMESTAMP=Thu Oct 18 18:29:15 2018 TIMESTAMP=Thu Oct 18 18:29:27 2018 TIMESTAMP=Thu Oct 18 18:29:27 2018 TIMESTAMP=Thu Oct 18 19:06:32 2018 TIMESTAMP=Thu Oct 18 19:06:32 2018
Maybe it's because each individual log entry is broken up by newlines?