I agree with simon and combatsquirrel in the way the program should be solved. In addition, you have recieved some good advice on picking up meryln's book ("Learning Perl" published by O'Reilly), (etc) to improve your style. Being on a boring telecom, I'll give your code a quick review though for some of the misconceptions you would like pointed out. Others can add more. Perl is weird in that "Perlishness" is kind of a zen, so writing baby-perl (as either Merlyn or Larry or Tom put it) is acceptable as you attempt to write more perl in the style of the perl idiom.

In my opinion (and all things are always subject to debate):

These are just a bunch of random comments, but you were asking for them, so I thought I would share. As you grow as a Perl programmer you will learn new tweaks and stuff, and your code will grow more elegant and easy to understand. Enjoy the process, as Perl is a really fun language and allows for some neat constructs. Don't be worried that people are pointing out ways you can improve, this monastery is an incredible resource. Most of all, realize Perl is fun!


In reply to Re: Code Optimization v5.8.1 by flyingmoose
in thread Code Optimization v5.8.1 by bluethundr

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.