> -----Original Message-----
> From: Scot Needy [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, January 20, 2003 4:58 PM
> To: NYIMI Jose (BMB); Beginners Perl
> Subject: RE: Nested hash creation help ! 
> 
> 
> 
> Thanks Jose!
> 
> I have the hash created and now can see the values
> using Data::Dumper but now I an having trouble walking the 
> hashtree. Trying to walk back out to each leaf value in the tree.
> 
> Hash def 
> $time=>{$custname}{$custsub}{$site}{$YYMMDDay}{'start'} = $hhmmsss;
> 
> 
> This doesn't seem to get anything but $c.
> 
>   foreach my $c (sort keys %time) {
>      print "Cust $c\n";
>      foreach my $cs (sort keys %{$time->{$c}}) {

If you write this $time->{key} that means the variable 'time' is a 'reference to an 
hash' not an 'hash'.
Since you declared your 'time' beeing an hash as follow: %time=();
You should not be using the arrow notation. Use this intead : $time{key}

If really want to arrow notation, you need to declare 'time' like this :

my $time={};#reference to an anonymous hash

#filling-in as follow
$time->{$custname}{$custsub}{$site}{$YYMMDDay}{'start'} = $hhmmsss;

#dereference stuff
foreach my $c (sort keys %{$time} ) {
        bla bla ..
}

HTH,

José.


>         foreach my $s (sort keys %{$time->{$c}->{$cs}}) {
>          print "Site $c.$cs.$s \n"
>          #..etc . next branch . etc
>         }
>      }
>   }
> 
> 
> -----Original Message-----
> From: NYIMI Jose (BMB) [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 20, 2003 6:11 AM
> To: [EMAIL PROTECTED]; Beginners Perl
> Subject: RE: Nested hash creation help !
> 
> 
> Afterwards, to see how your nested hash looks like,
> try this:
> 
> use Data::Dumper;
> print Dumper(\%time);
> 
> José.
> 
> > -----Original Message-----
> > From: Scot Needy [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, January 20, 2003 6: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]
> >
> >
> 
> 
> **** DISCLAIMER ****
> 
> "This e-mail and any attachment thereto may contain 
> information which is confidential and/or protected by 
> intellectual property rights and are intended for the sole 
> use of the recipient(s) named above. Any use of the 
> information contained herein (including, but not limited to, 
> total or partial reproduction, communication or distribution 
> in any form) by other persons than the designated 
> recipient(s) is prohibited. If you have received this e-mail 
> in error, please notify the sender either by telephone or by 
> e-mail and delete the material from any computer".
> 
> Thank you for your cooperation.
> 
> For further information about Proximus mobile phone services 
> please see our website at http://www.proximus.be or refer to 
> any Proximus agent.
> 
> 
> --
> 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