suzka99 has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to create a matrix of authors who have
shared a thread, the 0 for never shared and 1+ for the
number of threads shared.
# get list of every author foreach $from (sort keys %authors) { foreach $subject(keys %subjects) { # populate buddy list @buddies = split(/\t/, $subjects{$subject}); # add each $buddy to %authors{$author} hash foreach $buddy(@buddies) { #this doesn't work # i want to add the buddy relationship if it does # not exist, else I want to increment the value ${$authors{$from}}{$buddy}++; } }
Thanks a lot in advance.
update (broquaint): s|<(/)?pre>|<${1}code>|g
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Adding values to a hash of hashes
by tachyon (Chancellor) on Mar 06, 2003 at 09:59 UTC | |
by suzka99 (Initiate) on Mar 06, 2003 at 22:03 UTC | |
by zby (Vicar) on Mar 06, 2003 at 10:09 UTC | |
by tachyon (Chancellor) on Mar 06, 2003 at 10:18 UTC | |
by suzka99 (Initiate) on Mar 06, 2003 at 21:54 UTC | |
by tachyon (Chancellor) on Mar 06, 2003 at 23:22 UTC | |
|
Re: Adding values to a hash of hashes
by zby (Vicar) on Mar 06, 2003 at 09:55 UTC | |
|
Re: Adding values to a hash of hashes
by Hofmator (Curate) on Mar 06, 2003 at 10:21 UTC |