|Perl Monk, Perl Meditation|
Ternary vs. Sort vs. Maxby QM (Parson)
|on Aug 10, 2015 at 09:23 UTC||Need Help??|
A line in BrowserUK's post reminded me of one of my cobwebs that I'm always chasing, namely, whether the Conditional Operator, ?:, is preferable over sort. In the end I should import a max function when possible, but I don't always do so.
I find this awkward to read, and it also duplicates the variable names.
But because sort needs a numeric sort function, that's a bit long winded.
And the max function:
Which seems to be the laziest and preferred way.