In that case you want the keys and values the other way round:
if (!$responses{$answer})
{
$responses{$answer} = [ $name ];
}
else
{
push @{$responses{$answer}}, $name;
}
foreach $answer (sort keys %responses)
{
print "$answer: ", join (", ", @{$responses{$answer}}), "\n";
}
阅读(1482) | 评论(0) | 转发(0) |