Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
A large problem is that you seem to be assuming that:
  • A. Everyone you do a whois on is going to be registered with Network Solutions
  • B. Network Solutions will never change their format.

Both are dangerous assumptions: I would definitely look at Net::Whois as mentioned above. It was made for this sort of thing.

Nonetheless, here is a quick fix of the code above. Not the best, but a little more readable.

#!/usr/bin/perl -w use strict; my ($DNS,$registrant,$admin,$tech,$billing,$domain_name,$expires); while (<>) { /^ ([\S]+)\s+[\d.]+/ and $DNS.="$1\n" and next; s/^\s+//; next unless length; m#Registrant:# .. m#\)# and chomp($registrant=$_) and ne +xt; m#Administrative Contact:# .. m#\)# and chomp($admin=$_) and ne +xt; m#Technical Contact:# .. m#\)# and chomp($tech=$_) and ne +xt; m#Billing Contact:# .. m#\)# and chomp($billing=$_) and ne +xt; /Domain Name:\s+([\w.]+)/ and $domain_name=$1 and next; /Record expires on\s+([^.]+)/ and $expires=$1 and next; } write STDOUT; format STDOUT = ====================================================================== +========== @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $domain_name Registrant: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<< $registrant Admin: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<< $admin Tech: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<< $tech Billing: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<< $billing DNS: ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<< $DNS EXPIRES: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<< $expires .

In reply to Re: A looping and format question... by turnstep
in thread 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":



  • 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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2022-08-09 19:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?