develooper Front page | perl.beginners | Postings from March 2002

how to sort, in to out

Thread Next
From:
Jerry Preston
Date:
March 21, 2002 04:14
Subject:
how to sort, in to out
Message ID:
3C99CE88.33ADDEEC@ti.com
Hi,

I am trying to figure out an easy way to sort out a array of numbers:

2 20 38 56 75 93 -17 -35 -53 -72 -90

Into the following:

-90 -72 -53 -35 -17 2 20 38 56 75 93

I have done the following:

  @x_step  = grep { ! $x_step_t{ $_ }  ++ } @x_step_t;

  @x_step = sort {$a == $b} @x_step;

To get the first line.

Any ideas?

Thanks,

Jerry




Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About