Hint 1: Your script has 10 lines where the user has to type in numbers. Obviously too much when he should type in only 5

Hint 2: Sorting the numbers is hell if you have them in single variables (i.e. $a,$b,$c...). I'm sure your teacher showed you how to use arrays. You need them here

Hint 3: You could simply use the function sort() as kcott said. But if you want or need to sort without using that function, you will need loops, otherwise sorting the numbers is still hell

Hint 4: There are a lot of methods to sort numbers (or anything else sortable). Do you know one? If not, think of how you would do it if you had them on paper and would have to sort them by hand, but could only see one number at a time (or compare and switch two numbers at a time).

Generally most sorting algorithms do that in two steps: 1. Go through all numbers and do something so that the numbers are sorted a little better 2. Repeat step 1 until step 1 can't make the order any better. Note that both steps are loops, step 1 the inner loop, step 2 the outer loop.


In reply to Re: Check this code please? by jethro
in thread Check this code please? by rse2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.