John W. Krahn wrote:
my %HoH; while (my $line = <DATA>){ chomp $line; my ($prod, $flavor) = split ' ', $line, 2; $HoH{ $prod }{ $flavor } = (); } for my $i ( keys %HoH ) { print "$i -- @{[ keys %{$HoH{$i}} ]}\n"; }
Does it matter that the value of the HoH is undef? jelly -- strawberry apple grape pear jam -- strawberry apple grape milk -- plain strawberry chocolate $HoH = { 'jelly' => { 'strawberry' => undef, 'apple' => undef, 'grape' => undef, 'pear' => undef }, 'jam' => { 'strawberry' => undef, 'apple' => undef, 'grape' => undef }, 'milk' => { 'plain' => undef, 'strawberry' => undef, 'chocolate' => undef } }; -- IBM: Inshallah Burak Ma'lesh 22:25:01 up 14 days, 19:16, 0 users, load average: 0.46, 0.41, 0.37 Linux Registered User #241685 http://counter.li.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/