Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I like to run with warnings on. But sometimes I don't see them, like for instance, when I was editing a fairly substantial mod_perl script, which printed a whole bunch of stuff to the log, hiding any warnings in the scrollback.

Because I didn't see the warnings, I spent some frustrating time trying to discover what is going on in code that went something like this:

my $some_index = 0; while ($thing = $thingies->next) { my $some_index = $thing->something_or_other; last if (test_for_fitness($some_index)); }

Yeah, I had originally declared the variable in the loop, but then I realized I would need it outside the loop, moved the declaration out, and forgot to remove the inner my. The loop worked perfectly, but the moment the program left the loop, $some_index was restored to 0 again.

And that is why I like perl warning me about a re-used my declaration.

I know it's not what you asked, just some food for thought


In reply to Re: Perl Warnings... by matija
in thread Perl Warnings... by Rodster001

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-19 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found