Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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 "," 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.

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

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2022-08-17 17:44 GMT
Find Nodes?
    Voting Booth?

    No recent polls found