Hi Jeff Ji, your program worked. But i couldn't understand the second
line.. That long print statement. What happened there? My 'simple'
sort arranged numbers in dictionary style.. Like 0 then 1 then 17 then
2 and then 29.. And how come in using strict module, that $a and $b
didnt make any noise? When i did it on command line, it said

was unexpected at this time.

On 3/4/07, Jeff Pang <[EMAIL PROTECTED]> wrote:

>
>I'm unable to arrange the numbers in an array in ascending order.. I
>tried the following
>
>@asc = sort{$$a<=>$$b} @list;
>
>but it didnt work. I did a subroutine
>

What's your array's content?
It do can work using Perl's sort (see below),also please see 'perldoc -f sort'.

$$ perl -le '@arr = (3,2,1,4,5);print join " ",sort {$$a <=> $$b} @arr'
1
2
3
4
5



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


Reply via email to