Right off the bat, you've got a missing closing brace } somewhere in the code, that is likely triggering many of the other errors.

I started trying to sort it out, but your code is so poorly indented it is difficult, but appears you aren't closing this for loop: for my $NODE (@sContent){.

Get in the habit of indenting your code properly, otherwise these types of issues can be hard to track down. Indent once for each block:

sub this { for (@this){ print "this\n"; if ($thing){ print $thing; } } }

Also, don't define your variables at the top of each sub like that... Declare them right before or as they are used, especially in a for loop:

foreach my $FQDN (...){

Cleaning up your code layout will allow you to spot issues with closing braces much more readily, and that alone will allow you to sort out the other issues one at a time, and visually see which scope everything is supposed to and is in.

Also, you have a lot of erroneous whitespace... sometimes items after commas have a space, sometimes not. You use brackets inconsistently as well. Putting a & before a function call isn't required. It's legacy, and currently is only needed in certain circumstances, none of which you're using. Using a consistent style helps tremendously.

-stevieb


In reply to Re: Compilation error in the perl script by stevieb
in thread Compilation error in the perl script by shroh

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.