##  Bon jour.

## Just for clarity: What is your distinction between "domain" and "name"?
 ##  "Domain" the first two levels, and the rest "name"??

 ##  Well, I thought it over; if you have just one hash entry
 ##      '64.207.97.183' => www.nigeria.gov.ng
 ##  and you put it into your hash:

$H{ '64.207.97.183'}{ng}{gov}{nigeria}{www}='is read';

 ##  then both the tests

print "www.nigeria.gov.ng\n" if exists $H{ '64.207.97.183'}{ng}{gov}{nigeria}{www}; print "nigeria.gov.ng\n" if exists $H{'64.207.97.183' }{ng}{gov}{nigeria};

 ##  will be true, allthough you did not yet have an entry
 ##       '64.207.97.183' => nigeria.gov.ng   (without "www.")
print "----------------------------------\n";

 ##  And, even worse, if later you have this domain
 ##       '64.207.97.183' => nigeria.gov.ng   (without "www.")
 ##  and you enter it into your hash like this:
$H{ '64.207.97.183'}{ng}{gov}{nigeria}='is read';
 ##  then
print "www.nigeria.gov.ng\n" if exists $H{'64.207.97.183' }{ng}{gov}{nigeria}{www};
 ##  will no longer hold true.
print "----------------------------------\n";

 ###########################################
 ##  Try this, add a hash entry "{is_read}":

$H{'64.207.97.183'}{ng}{gov}{nigeria}{www}{is_read}=1;
$H{'64.207.97.183'}{ng}{gov}{nigeria}{is_read}=1;

 ##  If you test:

print "nigeria.gov.ng\n" if exists $H{'64.207.97.183'}{ng}{gov}{nigeria}{is_read}; print "www.nigeria.gov.ng\n" if exists $H{'64.207.97.183'}{ng}{gov}{nigeria}{www}{is_read};

 ##  these tests work as desired.
 ##  Right?

 ##  And one remark:
## To me it seems a good style to post such a task as a small typical perl script, maybe one can play around and test and solve the problem.

 ##  Au revoir,
 ##  Detlef

Reply via email to