Someone once told be a bit of wisdom: "Just because you can doesn't mean you should".

$. gets the job done, and it works consistently in a logical fasion. However, it's a shortcut, and it's not strictly necessary. If you want to show off, or you are in a tremendous rush where every keystroke counts because you are just doing something simple with -e, then by all means, use variables like it.

If you want to write something that is useful and comprehensible to others, be a sport and keep it simple.

If your favorite author suddenly started to use a heavy helping of very obscure words in their writing, would you go through all the trouble to look each and every one up? Does using fancy words make for a better book, or does it just make the author seem like some kind of deranged thesaurus addict?

In Code Complete, which frowns on "fancy code" heavily, an example given is the ?: operator which is fairly easy to understand, but can get way out of hand if used to an extreme. You can lose track of the meaning of the code even though it works:
if ($foo?$x?($y|$a<<2):$s&$z?$x==$v:0:$c) { ...
That might be the slickest, most compact, fastest executing way of expressing your particular problem, but to most people, it is going to be virtually impossible to find a problem with it. In some cases, "other people" means yourself a few years down the road when you've nearly forgotten how the program worked, yet have to fix a slight bug that was discovered.

Express it in a manner that is as simple as possible, but no simpler.

In reply to Re^6: Determining what line a filehandle is on by tadman
in thread Determining what line a filehandle is on 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.