# 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}++; } }