I suspect that you are right. I will have to "noodle on this a bit" to completely convince myself, but I suspect that it is true.

As often happens in these threads, we have gone a long way from the original question about "reset"! I believe that there is consensus that package scoped variables and reset is not the best way although this is part of the language. I was surprised, but this IS truly a language construct. However, just because "it works", doesn't mean that it is a good idea - smaller scoped lexical variables is the "right" idea. Then we got onto map{} and how to suppress an "undef" value which is also a good idea.

Now we are onto something that hasn't come up in the last few years of my coding. Almost all my subs{} return something and that result is expected and used or I consider this a coding error. Subs that don't return things are signal handlers or subs that modify a reference that is passed in. Basically I don't try to check return values from subs that aren't expected to return anything as a lvalue and I don't have much experience checking for this situation in a normal sub.

I figure that until proved otherwise AnomalousMonk has it right! Great work! Thanks!


In reply to Re^7: reset particular variable by Marshall
in thread reset particular variable by abubacker

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.