--- Mark Salazar <[EMAIL PROTECTED]> wrote:
> I was recently bitten by this, and it's not clear to me (and others)
> if this is correct Perl behavior or not.
> If you have a user defined function 'func' that returns a list and
> you'd like to sort that return value it's reasonable to try:
>   sort(func(@list));
> 
> but apparently Perl interprets this as:
>   sort func @list;
> 
> thereby using 'func' as an ordering function instead of first
> processing '@list' with 'func' then sorting.  Now I've read the stuff
> on page 1 of PERLFUNC(1) about parenthesis and whitespace being
> optional, but still this just strikes me as wrong.  No?

lol -- never been bitten by that one, but it makes sense.
Nasty, but one of those things.
Add a & in front of func to tell sort "this is not for you". =o)

 print sort &func(@list);




=====
print "Just another Perl Hacker\n"; # edited for readability =o)
=============================================================
Real friends are those whom, when you inconvenience them, are bothered less by it than 
you are. -- me. =o) 
=============================================================
"There are trivial truths and there are great Truths.
 The opposite of a trival truth is obviously false.
 The opposite of a great Truth is also true."  -- Neils Bohr

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Reply via email to