So before retirement, a former employee wrote a series of perl scripts that capture and analyze SNMP and other types of events within the intranet, sending important ones on to the operator console used by support staff. The line $EVmsg = sprintf($DIcas_text, @HR) ; rarely, but occasionally, produces the runtime error: Use of uninitialized value in sprintf at evmon.pl line 1194. What I would like to do is add some perl that would write to an error log, in this singular case, not only this error, but the values of $DIcas_text, @HR, and possibly a few other variables that would help us debug the situation. I'm not certain how best to intercept and augment the message with the additional information. This is perl5 revision 5 version 8 subversion 4, running on Linux. Can anyone point me to relevant tutorials, etc. on how to approach this situation? I don't want a lot (any?) extraneous output when there are no errors. Thank you

In reply to Troubleshooting perl runtime errors by lvirden

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.