Uh! Bad advice (the "shorten your variable names", not the map example)! Sorry, just my humble opinion.

As soon as the scope of the variable you use is larger than 5 lines, use Identifiers::Long! ;)

Then, if it's just 5 lines, you'll survive typing a long name two or three times either. When someone else will need to read your code -- and after 6 Months you yourself are someone else -- he'll be glad to have meaningful names.

I banned $i for counters right after school (where the formula's my programs were based on used i, of course), and I never missed it. Even if it's an iteration I'd rather use $iteration_count. And in case of indices it's nice to expess what your're indexing.

And let's be honest, typing $request especially in a coding situation takes me no longer that typing $r. Well almost... It surely takes more time to read (and lookup/translate and undestand) $r for anyone not knowing the obvious...

If I don't want to repeatedly type an identifier with a fancy name I simply cut and paste. Of course, it's good to know how to do that using your keyboard... ;)

There's enough abbreviation in Perl anyway ($_, $a, $b, $#array, etc.).

So, while I'm with you that obfuscuated perl is cool and fun, yet for serious work it's cool to use @long_names, and lame to be $lzy.

So long,
Flexx

PS: I know I am a style phanatic.

Update: Humm... I just realized I talked back to a saint... :] (...) a lazy saint. ;)


In reply to Long identifiers are fine (Re^2: CGI Tables) by Flexx
in thread CGI Tables 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.