in reply to How to make perl sort these values in order?
my @n; while (@n < 5) { if (@n) { print "Type in another number: "; } else { print "Type in a number: "; } chomp( my $n = <STDIN> ); push @n, $n; } print "$_\n" for sort { $a <=> $b } @n;
Update: Added compare function as per reply.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to make perl sort these values in order?
by CountZero (Bishop) on Aug 07, 2011 at 06:58 UTC |