first, because it's a bit odd to change the logic of some code to fix a warning
I don't think that logic changing is solely for fixing the warnings. The warnings show up because you ask for it, you ask Perl to warn you if it thinks that you might do something you don't intent. Perl is not always right about this, but mostly is. And there's another way to supress the warning if you're sure about what you're doing without changing the logic. Even if the changing is solely for fixing the warning, I don't see it as odd at all. Most Perlers, at least those around here, don't like the warnings show up, and clutter the error log unintentionally (in the case of web applications).
second, it ignores TMTOWTDI
How the logic changing ignores TMTOWTDI? Changing the way something is done is clearly to show another way to do it.
And a solution to the warning was never very interesting to me
I think I understand your intent in your OP. You think the elsif is in the equal scope as if but Perl doesn't think so hence the warning. But you're interested in knowing why instead of how to get rid of the warnings. The thing is, if you try to understand what the warnings mean, you'll know how to solve the real problem, and get rid of the warnings as well. Hopefully.

Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!


In reply to Re^2: strange scope by naikonta
in thread strange scope by anagramster

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.