Your question is not clear to me.
To me it seems that you want to have a  clear hierarchy:
IPN > 1st level domain > 2nd level domain > 3rd level domain > ... nth level domain e.g. 64.207.97.183 > com > web-mania > server7

And for this I would mould a hashes landscape. What is the difficulty?


BTW, do you have some hundred entries, or thousands of entries?
(If MacPerl hashes grow too big, they can become slow and malicious; so one could prefer an SQL-solution.)

Salut,
Detlef Lindenthal






Louis Pouzin wrote:

Hi everybody,

Perhaps there are still some listeners on this list.

Experiencing some hitches with a hash structure.

In order to match data from two sources, I want to build a structure like this:

  $H{$ip}[0]{$nam} and $H{$ip}[1]{$dom}

where $ip, $nam and $dom are keys from input data records

There may be several names and domains for one ip, as this snippet shows:

my %H = ();
my $ip = '64.207.97.183'; # data are fictitious
my $nam1 = 'server7.web-mania.com';
my $nam2 = 'asuc.berkeley.net';
my $nam3 = 'www.berkeley.net';
my $dom1 = 'web-mania.com';
my $dom2 = 'berkeley.net';
$H{$ip}[0] = {$nam1,'',$nam2,'',$nam3,''};
$H{$ip}[1] = {$dom1,'',$dom2,''};
print "name $nam2 exists" if exists $H{$ip}[0]{$nam2};
print "domain $dom1 exists" if exists $H{$ip}[1]{$dom1};
print "name $dom1 exists" if exists $H{$ip}[0]{$dom1};
print "domain $nam2 exists" if exists $H{$ip}[1]{$nam2};
@_ = keys %{$H{$ip}[1]};
$" = ', '; print "domains: @_";
__END__
output:
name asuc.berkeley.net exists
domain web-mania.com exists
domains: berkeley.net, web-mania.com

So far nothing special. The hitch is that data pertaining to the same ip may be 
input later in the process, bringing possible additional names and domains.

There must be a simple way to "grow" the innermost hashes, save from trashing 
the elements and putting them back in. But I have not found it in my docs.

Any good idea out there ? Thanks.




Louis Pouzin wrote:

Hi everybody,

Perhaps there are still some listeners on this list.

Experiencing some hitches with a hash structure.

In order to match data from two sources, I want to build a structure like this:

  $H{$ip}[0]{$nam} and $H{$ip}[1]{$dom}

where $ip, $nam and $dom are keys from input data records

There may be several names and domains for one ip, as this snippet shows:

my %H = ();
my $ip = '64.207.97.183'; # data are fictitious
my $nam1 = 'server7.web-mania.com';
my $nam2 = 'asuc.berkeley.net';
my $nam3 = 'www.berkeley.net';
my $dom1 = 'web-mania.com';
my $dom2 = 'berkeley.net';
$H{$ip}[0] = {$nam1,'',$nam2,'',$nam3,''};
$H{$ip}[1] = {$dom1,'',$dom2,''};
print "name $nam2 exists" if exists $H{$ip}[0]{$nam2};
print "domain $dom1 exists" if exists $H{$ip}[1]{$dom1};
print "name $dom1 exists" if exists $H{$ip}[0]{$dom1};
print "domain $nam2 exists" if exists $H{$ip}[1]{$nam2};
@_ = keys %{$H{$ip}[1]};
$" = ', '; print "domains: @_";
__END__
output:
name asuc.berkeley.net exists
domain web-mania.com exists
domains: berkeley.net, web-mania.com

So far nothing special. The hitch is that data pertaining to the same ip may be 
input later in the process, bringing possible additional names and domains.

There must be a simple way to "grow" the innermost hashes, save from trashing 
the elements and putting them back in. But I have not found it in my docs.

Any good idea out there ? Thanks.


Reply via email to