Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: A looping and format question...

by turnstep (Parson)
on Dec 13, 2000 at 20:48 UTC ( #46440=note: print w/replies, xml ) Need Help??

in reply to A looping and format question...

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 .

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://46440]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2022-08-09 20:42 GMT
Find Nodes?
    Voting Booth?

    No recent polls found