Hello everyone,
I am trying to sort an array returned by a subroutine.

I realize it would be better if the subroutine returns
a Sorted Array instead of Sorting the Returned Array, however
I would like to know why sort doesn't work on a Returned Array and
why the returned array has to be parenthesized.


#sortarray.pl print join("\n",sort arraytest() ),"\n";

#This works --> print join("\n",sort (arraytest()) ),"\n";
#Don't know why this works --> print join("\n",sort &arraytest() ),"\n";


sub arraytest()
{
    my (@array) = qw( 1 2 3 9 8 7 );
    return @array;
}

Thanks.
-gohaku


-- 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