Dru has asked for the wisdom of the Perl Monks concerning the following question:
Here is the script. Constructive criticism welcome.Use of uninitialized value in hash element at D:\scripts\whois.pl line 21, <FILE> line 1.
#Program used to get an ip address via a whois query using the clwhois tool use strict; use warnings; my $cmd = 'd:\clwhois.exe'; my $ip = '192.168.1.1'; my $file = 'd:\temp\output.txt'; my ($email, %fields); system("$cmd $ip >$file") and warn "Can not execute $cmd: $!\n"; open (FILE, $file) or die "Can not open $file: $!\n"; while (<FILE>){ /^(.*?): \s*(.*)$/; # Save text before colon in $1, and after # colon in $2 - Taken from the Camel Chp. 5.9 $fields{$1} = $2; # Creat %fields hash } # Save email address to $email depending on the whois db being used if ($fields{"TechEmail"} ne ""){ $email = $fields{"TechEmail"}; } elsif ($fields{"e-mail"} ne ""){ $email = $fields{"e-mail"}; } print "Email is $email\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: uninitialized value in hash element Error
by Paladin (Vicar) on Jul 03, 2003 at 19:54 UTC | |
|
Re: uninitialized value in hash element Error
by Anonymous Monk on Jul 03, 2003 at 19:56 UTC | |
by Dru (Hermit) on Jul 03, 2003 at 20:15 UTC | |
|
Re: uninitialized value in hash element Error
by Cody Pendant (Prior) on Jul 03, 2003 at 23:44 UTC | |
by Dru (Hermit) on Jul 04, 2003 at 12:56 UTC |