<readme> Is there a way to suppress output? In other words, perl newbie is running through a file doing an nslookup in DOS – performing an nslookup on ip addresses to get the hostname. My sysadmin (at work)does not approve acitive state to be installed on workstation - will only let me use perl.exe w/ perl56.dll, so I can't use perl modules. Would appreciate any help. Code looks like this…</readme>
@nsl = `nslookup $_`; $reso = $nsl[3]; if ($? = 0) { $getit = (split (/\s+/, $reso))[1]; # pull hostname only print “$_ -> $getit\n”; } else { print “$_ - could not resolve.\n”; }
<readme> The output looks real good if it successfully resolves ip to hostname, but the problem comes in if it can’t resolve – my output looks crappy – like this… </readme>
***dc1 can’t find server name for address 9.0.1.2: Non-existent domain 1.2.3.4 -> Hostname1 5.6.7.8 -> Hostname2 9.0.1.2 -> Could not resolve. 3.4.5.6 -> Hostname7 ***dc1 can’t find server name for address 7.8.9.0: Non-existent domain 7.8.9.0 -> Could not resolve.
<readme> Is there a way to suppress all the ***Can’t find server name… crap out of my output and keep the output pretty? It seems pretty simple but I can’t get my hands on it. Thanks. </readme>

In reply to Suppress output from nslookup by jorain

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.