I'm still a newbie @ references and data structures myself, but I've
found the following web pages useful:

http://www.perldoc.com/perl5.8.0/pod/perlreftut.html
http://www.perldoc.com/perl5.8.0/pod/perldsc.html
http://www.perldoc.com/perl5.8.0/pod/perllol.html

And, as always, by recursively following the references on these web
pages you can probably find a thousand pages of information overload.
:-D

-Dan

On Wed, 2003-11-12 at 20:28, Jason Normandin wrote:
> Hey Group
> 
> I am new to hashes, so please be kind : )
> 
> I am trying to create a hash of hash's with the following characteristics:
> 
> 1. The outer hash has a unique key called $ELEMENT
> 2. The value of the outer hash is a key to the innner hash called $DATE
> 3. The value of the inner hash is a value called $ERROR
> 
> I need to loop through some data which has multipe $DATE and $ERROR entries
> per $ELEMENT and add them to the $ELEMENT hash based on the $ELEMENT value.
> 
> Eg. Element Fred would have multiple DATE entries. Each date would have one
> error.
> 
> I then need to iterate through the hash and display the element name( only
> once if possible ), each timestamp and error.
> 
> Ex.
> 
> ELEMENT       DATE            ERROR
> jason         Jun 1, 2003     No Data
>               Jun 4,2003      No Response
>               July 1,2003     No Data
> fred          Jan 2, 2002     No Response
>               Jany 4,2002     Illegal value
> ....
> ..
> 
> This is just a dummy example. The real error types range and are unique.
> 
> Can anyone help with my constructing such a hash ?
> 
> I tried the following, which sucessfully creates the outerhash, but only
> populates one value for each date, error pair:
> 
>       $snmpErr{$ELEMENT}= 
>       {
>               name => $ELEMENT,
>               date => $DATE,
>               error => $ERROR
>       };
> 
> I then loop through via:
> 
>       foreach my $entry (keys %snmpErr)       
>       {
>                       $el = $snmpErr{$entry}{name};   
>                       $ts = $snmpErr{$entry}->{date};   
>               $er = $snmpErr{$entry}->{error};
>       }
> 
> How far off am I ? : )
> 
> Thanks for the help all !!
> 
> - Jason
> 
> 


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

Reply via email to