The condition is not "dense".

I didn't say it was dense. What does that even mean? At what point does something become dense? How can you claim it is or isn't dense?

I said the "condition is so dense you missed that it devolves into an infinite loop of prints and warns." You tried to jam so much into a single expression that you got the expression wrong. Worse, and maybe even more importantly, it's very hard to notice that it's wrong because it's so dense. I only noticed when I rewrote your code.

Works fine for me

How would you know? You didn't try giving EOF or an error. The fact that your code doesn't handle this immediately stood out after a rewrite.

I am sure that there are many Monks who will disagree with style issues!

Sure, but when it's so hard to read that errors crop in, and when the other alternative makes the error obvious, we start leaving the realm of subjectiveness and entering the realm of objectiveness.

Also, it leaks the $line variable to the surrounding scope.

Seeking work! You can reach me at ikegami@adaelis.com


In reply to Re^5: $_ not set in while <> by ikegami
in thread $_ not set in while <> by pidloop

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.