Re: HoA question

2006-12-28 Thread M. Lewis
John W. Krahn wrote: M. Lewis wrote: John W. Krahn wrote: my %HoH; while (my $line = ){ 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

Re: HoA question

2006-12-28 Thread John W. Krahn
M. Lewis wrote: > John W. Krahn wrote: >> >> my %HoH; >> >> while (my $line = ){ >> 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

Re: HoA question

2006-12-28 Thread M. Lewis
John W. Krahn wrote: my %HoH; while (my $line = ){ 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 -- straw

Re: HoA question

2006-12-28 Thread M. Lewis
John W. Krahn wrote: M. Lewis wrote: I'm still experimenting with the HoA from a couple of days ago. I just realized there is the possibility for having duplicate elements of the array. How do I prevent that? Use a hash instead of an array. Thank you John. I wondered about that as I was c

Re: HoA question

2006-12-28 Thread John W. Krahn
M. Lewis wrote: > > I'm still experimenting with the HoA from a couple of days ago. I just > realized there is the possibility for having duplicate elements of the > array. How do I prevent that? Use a hash instead of an array. > #!/usr/bin/perl > > use strict; > use warnings; > > use Data::Du

HoA question

2006-12-28 Thread M. Lewis
I'm still experimenting with the HoA from a couple of days ago. I just realized there is the possibility for having duplicate elements of the array. How do I prevent that? Thanks, Mike #!/usr/bin/perl use strict; use warnings; use Data::Dumper::Simple; my %HoA; while (my $line = ){ c