Okay, that's a start. I see some problems that you should be able to fix.

When I'm not sure why a script isn't doing what I expect, a good exercise is to write a comment before each line telling what I think that line of code should do. If it's a complicated line I write a comment for each part of the line. (This is a variation on "rubber duck debugging".)

Then I add debugging code to print out the results after each step. This way I can find where things stop behaving as I expect them to behave.

You won't learn much if someone just tells you "do this instead" and provides a ready-to-use solution. If you work it out for yourself you will have learned not only how to fix this problem but also how to approach the next problem you have to solve.

Past this advice, as AppleFritter pointed out, you'll need to understand what you want your results to look like -- and you'll have to tell this to the people you're asking for guidance. Post an example of the output you'd like your code to produce.


In reply to Re^3: Sorting using the highest last column criteria by Bethany
in thread Sorting using the highest last column criteria by deepakshyl

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.