Sergio Escalada wrote:

Hi all! I would like to know if it's possible to make an array sorting with
a subroutine call.

Usually, a sort is made as, for example:


sort {$a <=> $b} @array;


But my intention is something like:


sort subroutine_call @array;

sub subroutine
{
$a <=> $b;
}


How could I do it?

Hello Sergio

It will work almost exactly as you have written it. Just use the name of
the subroutine in the call to sort:

 sort subroutine @array;

 sub subroutine {
   $a <=> $b;
 }

HTH,

Rob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to