rse2 has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
I wrote a program where a user types in five numbers, and then it displays the numbers in the order of which they were typed. But i need to make my program Print the numbers that the user enters from least to greatest. Any idea how i can do this? So far i got.
#! /usr/bin/perl print "Type in a number."; $n1 = <>; print "Type in another number."; $n2 = <>; print "Type in another number."; $n3 = <>; print "Type in another number."; $n4 = <>; print "Type in another number."; $n5 = <>; print "$n1 \n"; print "$n2 \n"; print "$n3 \n"; print "$n4 \n"; print "$n5 \n";
Thanks a million.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to make perl sort these values in order?
by davido (Cardinal) on Aug 07, 2011 at 01:25 UTC | |
|
Re: How to make perl sort these values in order?
by james2vegas (Chaplain) on Aug 07, 2011 at 00:41 UTC | |
|
Re: How to make perl sort these values in order?
by ikegami (Patriarch) on Aug 07, 2011 at 04:30 UTC | |
by CountZero (Bishop) on Aug 07, 2011 at 06:58 UTC |