Apart from the problem cited by bart, there are a couple other syntax errors in the code you posted. This first line inside the if ($match) block is missing something:
($shortname) = ($device =~ /^\d+\./ $interface =~ /^\d+\./) ? ...
It's checking two regex matches, but there should be an "and" or "or" (or && or ||) between them -- or else there should be only one regex test. (Do you know what the intention is there? I don't.)

Then this line just after the lengthy comment is obviously bad:

$rc = sendtrap("$device", "$summary", "$descr", $intfc" "NODE_DOWN");
You're missing a comma before "NODE_DOWN", and you have an odd number of quotation marks. (You could actually get rid of all the double-quotes in that line except for the ones around "NODE_DOWN", but you need the missing comma.)

Running the script without fixing those (and the line pointed to by bart) will just generate a bunch of syntax errors. Is that what you meant by "I cannot get this to work correctly"? Or did you make mistakes in posting your code, and the version you're actually running has some other problem(s)?


In reply to Re^3: NNM Nonsense by graff
in thread NNM Nonsense by Perl_Pursuer

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.