Having a quick look, I may say your ploblem can be solved with hash references.

Something like:
my %hash_level1=();
my %hash_level2=();
$hash_level1{'tag'}=\%hash_level2;

To retrieve a value form hash_level2:
my $hash_p= $hash_level1{'tag'};
Return ${$hash_p}{'tag_from_level2'};

Hope it helps,

  Duarte 
-- 
Duarte Manuel Cordeiro 
Manager - IT Infraestructure - Security & Communications 
mailto:[EMAIL PROTECTED] |  msn: [EMAIL PROTECTED] |  
http://www.neoris.com/ 
-- 
Neoris Portugal 
Edificio Inovação IV - Sala 819 - Taguspark * 2780-920 Oeiras * Portugal 
Tel: +351 21 423-8350  |  Fax: +351 21 421-7626  | Mob: +35191 613-5706 
-- 

-----Original Message-----
From: Scot Needy [mailto:[EMAIL PROTECTED]] 
Sent: Monday, January 20, 2003 5:50 AM
To: Beginners Perl
Subject: Nested hash creation help ! 


Hi; 

 Trying to crate a nested hash from variables parsed out of log files but 
as I am a "Beginner Perl' coder it is failing terribly. The basic question 
is given you have 5 variables how would you make a nested hash. 

Thanks ! 
Scot 

I hope this is enough code to example my problem.   
-------------- snip ----------------------
foreach (@wwwlogs) {
        %time=();
        ($wwwname,$cust,$YYMMDDay) = split('\.',$_);
        open (LOG, $_ ) || die "Can't open $_!: $! \n";
      while (LOG>) {
      chomp;
           # Walk through log file and look for our string. 
           ($pid,$hhmmss,$host,$custname,$custsub,$site,$junk) = split('\|',$_);
           # print(SPLITVARS= $hhmmss,$host,$custname,$custsub,$site\n); 
           $time=>{$custname}=>{$custsub}=>{$site}=>{$YYMMDDay} = $hhmmss;
                       
      } etc etc etc   

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to