Several things about programming style spring to mind.

The first is that you are using global variables. A brush with strict.pm can help you avoid using them, which will lessen the chances that subroutines will interfere with each other.

The second is that Perl has interpolation so that you don't need to concatenate. It is simpler to write "FILE: $FILE\n" and most people will find it somewhat easier.

Thirdly from comprehension studies, people's comprehension of code is significantly improved when your indent is in the range 2-4. You are using 8 (full tab-stop) and that is going to make any complex logic substantially harder to follow.

And last but not least, ALL CAPS IS SHOUTING! Anyone who has been around on the net for a while will be used to that convention, and it makes your code very hard to read for any length of time. Yes, this is an "important irrelevancy", something that is important to be consistent on, but which choice you make is fundamentally irrelevant. However the connection between capitals and shouting is rather widely accepted.

Oh, and a final book recommendation. Code Complete by Steve McConnell is a good place to learn a lot about what makes up good (procedural) programming style. It is a classic. Read it.


In reply to Re (tilly) 1: Looking for a better way to get the number of lines in a file... by tilly
in thread Looking for a better way to get the number of lines in a file... by coec

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.