in reply to unxpected sort warnings while using sort
since you want individual numbers in separate array elements.local $/; # slurp mode
It is also a good idea to
after reading it in.chomp @data;
<=> is the right operator for sorting numerics.
instead of "(my @num= shift)", use
my @sorted=sort {$a<=>$b} @_;
"Despite my privileged upbringing, I'm actually quite well-balanced. I have a chip on both shoulders." - John Nash
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: unxpected sort warnings while using sort
by perlynewby (Scribe) on Jul 22, 2015 at 23:40 UTC | |
by AnomalousMonk (Archbishop) on Jul 22, 2015 at 23:53 UTC | |
by NetWallah (Canon) on Jul 23, 2015 at 04:09 UTC | |
by perlynewby (Scribe) on Jul 23, 2015 at 20:30 UTC | |
by AnomalousMonk (Archbishop) on Jul 24, 2015 at 00:19 UTC | |
by NetWallah (Canon) on Jul 23, 2015 at 22:33 UTC | |
by perlynewby (Scribe) on Jul 24, 2015 at 23:03 UTC | |
by marinersk (Priest) on Jul 23, 2015 at 02:04 UTC |