my $mode = $sorted_array[-1]; ## aren't negative indexes neat?