Bugorr has asked for the wisdom of the Perl Monks concerning the following question:
I have this code to check that everything is correct:my %subjects; foreach my $subm(@subm){ ($subject, $email, $time) = split(/^/, $subm); my %info; $info{email} = $email; $info{time} = $time; if(! exists $subjects{$subject}){ print "Key DOES NOT exist\n"; $subjects{$subject} = []; }else{ print "KEY DO EXIST\n"; } push @{$subjects{$subject}}, %info; }
Unfortunately, Size gives me size =1 , which is not true. Please tell me if I am doing something wrong....foreach my $key (sort (keys %subjects)){ print "\n\nKEY = $key"; my @ar = @{subjects{$key}}; my $size = @ar; print "\nSize of Array = $size"; }
Edited by Chady -- added code tags.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Updated Hashes & Arrays
by davidrw (Prior) on Aug 29, 2005 at 21:19 UTC | |
Re: Updated Hashes & Arrays
by shemp (Deacon) on Aug 29, 2005 at 21:12 UTC |