in reply to Sorting Times

You could also ...
%h = map { $a=$_; s{(\d+):(\d+)(A|P)} { sprintf("%02d:%02d",$1+($3 eq 'A'?0:12),$2) }e; $_ => $a } @times;
Now you have a hash where the key is military time and the value is your original time. You can do whatever want after that (including foreach (sort keys %h)).

my @a=qw(random brilliant braindead); print $a[rand(@a)];