Hello: gonna keep it brief, as I've gotta get back to work. I wrote my own little "whois" program to iterate through a list of domains work wants me to confirm. Got the data w/out too much pain. Now, I've got to print a report. I've got the format looking the way I want it, but I'm getting huge amounts of duplicates from the loop. Any help would be GREATLY appreciated. Here's my code: (keep in mind I'm a neophyte, so it won't be pretty!!)

#!/usr/bin/perl -w OUTER: while (<>){ s/^\s+//; # trim off whitespace... next OUTER if /^$/; # ignore blank lines chomp; $registrant=$_ if (/Registrant:/../\)/); $domain_name=$_ if /Domain Name.*/; $admin=$_ if /Administrative Contact:/../\)/; $tech=$_ if /Technical Contact:/../\)/; $billing=$_ if /Billing Contact:/../\)/; $expires=$_ if /Record expires on .*/; if (/NAME\..+\s+\d{1,3}.\d{1,3}.\d{1,3}/){ s/Name Server: .*//; push @names, $_; next OUTER; } write STDOUT if defined($registrant and $admin and $tech and + $billing and $names[2] and $expires); } format STDOUT = ====================================================================== +========== @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Registrant: @<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<<<<<<<< $domain_name , $registrant Admin: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<<< $admin Tech: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<<< $tech Billing: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<<< $billing DNS: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<<< $names[0] @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<<<<<<<<< $names[1] @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<< $names[2]@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<<< $expires ====================================================================== +========== .

.... I know the DNS portion of the above code is formatted poorly for this post, but it does work. For example, if I were to put in the output from a whois on "perlmonks.org," I'd end up with 18 or so duplicate reports. Any ideas? I'm sure it's a simple fix, but I've been looking at it for so long my brain is fried.
Thanks,
Matt

In reply to A looping and format question... by MCauth

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.