Hi,

First of all: You write good code.

Now on to the critisism (I don't quite understand what you are trying to achive (your file at the top has 2 fields but in your script you seem to deal with 10 of them and I had too much beer to guess what you probably could mean - which is why I will focus purely on formal stuff :-)

1) "perl -w" in the she-bang line and "use warnings" are pretty much the same thing (won't hurt of course :-)

2) You should check the result of your open-statements e.g. "open my $fh, "file" or die $!;"

3) Don't repeat yourself. Put the (common) directory that your files share into a variable, then you only have to change one line of code should you ever want to access files in a different directory.

4) Why chomp the first line when you want to discard it anyway?

5)The keys of your %clone_hash seem to be strings so you should simply sort them using cmp.


In reply to Re: processing key value pairs of a hash by morgon
in thread processing key value pairs of a hash by lomSpace

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.