Hi UpTide,

$_ is very generic and I have no idea what it means when I look back over my code

I would have recommended using $_ only over short pieces of code for exactly that reason. So for example, if you write print "$_\n" for 0..2; I personally think it's fine because you know that the scope of this $_ is only that one line. But there's nothing wrong with writing for my $i (0..2) { print "$i\n" } instead! In the same vein, I personally think that for (0..2) { ... } is fine if the loop body is only a few lines long, and I'd go with for my $i (0..2) { ... } if the loop body gets longer (there's a gray area on what is "too long"), but there's nothing wrong with always using the latter! It's all about what you and possible future maintainers would find most readable.

Regards,
-- Hauke D


In reply to Re^5: 36 Conditions in If Statement [sendhelp]] by haukex
in thread 36 Conditions in If Statement [sendhelp]] by UpTide

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.