Click here to get back home

Deeper level of hashing

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Deeper level of hashing dn.perl@gmail.com 05-02-2008
Posted by dn.perl@gmail.com on May 2, 2008, 7:15 am
Please log in for more thread options

I am using (roughly) the following code.

my %counter = () ;

$counter = 'label1' ;
$counter = 14 ;
$counter = 'label1' ;
$counter = 14 ;

If I use: for my $key(keys %counter), I get label11 and label12 as
values.
I would like to run something like: foreach my $key(keys %
($counter(label11) ) )
and get 'parent' and 'hits' as the sub-keys.

Is there any quick way to do this but quicker than what? So let's say
is there a 'standard way' in which this is done? Or do I have to do it
the 'hard way' ? Define a sub-hash, and then assign it to the parent
hash as its key's value?



Posted by Joost Diepenmaat on May 2, 2008, 7:23 am
Please log in for more thread options

> I am using (roughly) the following code.
>
> my %counter = () ;
>
> $counter = 'label1' ;
> $counter = 14 ;
> $counter = 'label1' ;
> $counter = 14 ;
>
> If I use: for my $key(keys %counter), I get label11 and label12 as
> values.
> I would like to run something like: foreach my $key(keys %
> ($counter(label11) ) )
> and get 'parent' and 'hits' as the sub-keys.
>
> Is there any quick way to do this but quicker than what? So let's say
> is there a 'standard way' in which this is done? Or do I have to do it
> the 'hard way' ? Define a sub-hash, and then assign it to the parent
> hash as its key's value?

Do you mean something like this?

foreach my $key (keys %}) {
print "$key => $counter->\n";
}


--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

Similar ThreadsPosted
hashing function November 28, 2004, 1:56 pm
Simple MD5 Hashing - Please Help!!! May 23, 2006, 6:52 am
making a meal out of hashing September 13, 2005, 3:14 pm
hashing mutliple rows from sql results? May 15, 2005, 5:57 am
Mailbox-style directory hashing October 31, 2006, 6:40 pm
accessing perl's internal hashing algorithm September 27, 2004, 9:14 am
How to redefine warnings on recursion level October 21, 2004, 11:11 am
Low level data manipulation in Perl January 16, 2005, 1:54 pm
Identify nodes in the same level using a pattern March 15, 2006, 1:14 pm
delete() on multi level hash February 23, 2007, 5:59 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap