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.
In reply to Re: How to make perl sort these values in order?
by ikegami
in thread How to make perl sort these values in order?
by rse2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |