$VAR1 = { 'WaterSports' => [ '8765', [ 'Drysuit', 'r', 'M-L' ] }; $VAR1 = { 'WaterSports'=> [ '8765', [ 'Drysuit', 'r', 'M-L' ] '8365', [ 'Paddle', 't', '45' ] ] }; #### open(INFILE, "products-id.txt")|| die "Cannot open products-id.txt fil +e"; open (OUTPUT,">$output") or die ("Can't open file $output $!"); chomp(my @ProductArray = map { /^\s*$/ ? () : $_ } ); close (INFILE); foreach my $line(@ProductArray) { my ($Category, $ID, $Name, $Type, $Size) = split( / /, $line ); push(@{$AllProducts{$Category}}, $ID, [$Name, $Type, $Size]); print OUTPUT Dumper(\%AllProducts); } #### push @{$AllProducts{$Category}}, ($ID, [$Name, $Type, $Size]);