http://qs321.pair.com?node_id=340033


in reply to Different hashes?

You are overwriteing the key in %AllProducts every loop. You need to make the hash value an array ref then push onto it.

Try this:
foreach my $line(@ProductArray) { my ($Category, $ID, $Name, $Type, $Size) = split( / /, $line ); unless(exists $AllProducts{$Category}){ $AllProducts{$Category} = []; } push(@{$AllProducts{$Category}}, $ID, [$Name, $Type, $Size]); print OUTPUT Dumper(\%AllProducts); }

- Tom