I see nothing technically wrong with your style, nor with the endorsements above.

But I am still impelled to offer a contrarian view.

Look to the long view.

If the script is more than a one_off, one_use package, think of your successor, as you may wish a predecessor had thought of you.

Surely, that hypothetical maintainer, perhaps generations from now, will find it easier to distinguish one $var from another, if you take the minimally non-lazy way of naming the $vars in the sub something like $sub_length, $sub_breadth and $sub_height.

Imagine all that and add a few (not unreasonable, IMO) additional complications; namely, that your script has become a part of your organization's backbone... AND has been "enhanced" by some intermediate generations; that the "bells & whistles" they've added have muddied the waters; and that your sub now resides some hundreds or thousands of lines from its original position of prominence and its original clear relationship to the caller.


In reply to Re: Confusion in naming variables in subroutines by ww
in thread Confusion in naming variables in subroutines by Anonymous Monk

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.