This sounds flippant, but I count lines with wc -l file. My coding style tends to rely heavily on complex data structures. For instance, I'm looking at one of my scripts that declares a hash of hashes that takes up 28 lines (and 110 chars wide). However by counting semis, that counts as only one line.

It does, however pack an awful lot of functionality away: scalars and coderefs. The code that operates upon it is then pretty simple: it just walks down the keys and tells the values to "do themselves".

What about here documents? What about TR's fed map{}ed arrays in CGI.pm? A line can represent a fearsome amount of code in Perl.

So all in all I just run wc and then get on with the job. If it were enough of an obsession and I was a student with a lot of time on my hands I'd consider writing a module to perform function point analysis.


--
g r i n d e r

In reply to Re: Line-counts of perl programs/modules by grinder
in thread Line-counts of perl programs/modules by Tarka

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.