in reply to Reverse Alphabetically Sorting an array

I'm not sure why I'd introduce the overhead of calling a subroutine, when "reverse sort" is a natural idiom (it reads like what it does).

Can you motivate your post a little better for me?

Also, keep in mind that recent Perls actually note the "reverse sort" combo, and never bother creating the forward list just to reverse it: instead, "sort" sorts backwards (how clever is that?).

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on •Re: Reverse Alphabetically Sorting an array

Replies are listed 'Best First'.
Re^2: Reverse Alphabetically Sorting an array
by matra555 (Monk) on Jan 10, 2005 at 13:09 UTC
    I could be mistaken, but if I was maintaining someone elses code, it would save me typing to write a sub and plug the arrays into it, rather than retype them to fit the idiom.

    Moreover, I did check the relevant categories in Q&A, and didn't see it there.

      I don't like adding functions for such overly trivial things. It doesn't take someone else any more effort to read reverse sort @foo than to read reversi @foo, but with the cute name you used for the latter, they'll have to look up what the function does in the first place.

      Makeshifts last the longest.

      It's not in there because it's obvious. :)

      --
      mowgli