In article <LI_Ve.198264$Hk.97930@pd7tw1no>, <a@mail.com> wrote:
I would like to do the following:
my list = (100,2,5); #create a list
my @sorted = sort {$a<=>$b} list; #sort ascending
#want @sorted = (2,5,100)
What's wrong with my list with numeric values?
Nothing in theory. It is hard to say for sure since you have not posted
actual code that compiles and runs. Try doing that and maybe someone
will be able to help you.
And, as I explained last week, this newgroup is defunct. Try
comp.lang.perl.misc in the future (but be sure and adhere to the
guidelines for posting to that group).
Like this:
#!/usr/local/bin/perl
#
use strict;
use warnings;
my @list = (100,2,5);
my @sorted = sort {$a<=>$b} @list;
print "sorted: @sorted\n";
.... produces ...
sorted: 2 5 100
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com