Then you want to update $itemList->{$menu}{$script} rather than assign a reference to a one-element hash to $itemList->{$menu}. $itemList->{$menu}{$script} = $name; ...
You can append your string, $_ = defined($_) ? "$_, $line[0]" : $line[0] for $hash{$line[1]}{$line[2]}; or use array which is better suited for storing list of elements, push @{ $hash{$line[1]}{$line[2]} }, $line[0]; ...
arrays,perl,hash,hash-of-hashes
This looks a lot like an XY problem. What are you trying to solve here? You can access an element of your data structure like this: print $my_hash{key01}[0]{key12}[0]{key22}[0]{key31}[0]{color},"\n"; You can also iterate the bottom elements with: foreach my $something ( @{ $my_hash{key01}[0]{key12}[0]{key22}[0]{key31} } ) { print $something->{'color'}; print $something->{'quantity'} }...
Using command line, perl -lane' $_->{m}<$F[2] and @$_{"s","m"} = @F[1,2] for $h{$F[0]}; END { print join" ", $_, @{$h{$_}}{"s","m"} for sort keys %h } ' file output A pqr 5.9 B ysc 4.7 C faa 4.7 D tar 3.5 script equivalent: local $\ = "\n"; # adds newline to print...
Use the -> operator. Everything underneath the HoH is a hashref, and accessing elements of those requires the -> operator. (Technically, you have a "hash of hashref" not a "hash of hash," since such a thing isn't possible.) See the perlref docs for details about references. $hoh{$group}->{$spec} UPDATE Here's a...