in reply to How can I use the value of a scalar as the name of an array variable?
my %HoA; while (<>) { chomp; my( $category, $item ) = split /\t/, $_, 2; push @{$HoA{$category}}, $item; } for my category ( sort keys %HoA ) { local $" = ", "; print "$category: @{$HoA{$category}}\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Answer: Can I determine if the value of a variable is the same as an arrays name?
by extremely (Priest) on Nov 29, 2000 at 11:24 UTC |