[Columbus-pm] perl question

Terrence Brannon schemelab at gmail.com
Tue Feb 14 04:27:29 PST 2012


Hi Mark, I figured someone would've answered by now who still lives in
Columbus, but I guess not.

Your question about getting the first statement to work... I presume the
'first statement' is
        sort rv @list;

And presumably you have some form of this statement that works with
parentheses? My solution would be:
      sort { $a <=> $b } (rv @list);

But your best option is the 'Seekers of Perl Wisdom' section on
perlmonks.org ... or perhaps ask on stackoverflow.com

Good luck and regards from South Florida,
Terrence (on my way to freeze and do Python in NYC)


On Mon, Feb 13, 2012 at 12:18 PM, Mark Geary <geary at prismnet.com> wrote:

> So, I've got this function that returns a list and I want to sort the
> returned list:
>
>    sub rv (@) { reverse @_; }
>    sort rv @list;
>
> but perl thinks I want to use rv as the sort comparison function. If I say:
>
>    sort reverse @list;
>
> then perl knows what I want to do. How do I make the first statement
> work without adding lots of parentheses?
>
> Mark Geary
> _______________________________________________
> Columbus-pm mailing list
> http://columbus.pm.org/
> Columbus-pm at pm.org
> http://mail.pm.org/mailman/listinfo/columbus-pm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/columbus-pm/attachments/20120214/acdd8791/attachment.html>


More information about the Columbus-pm mailing list