I'm looking for help understanding dereferencing with a complex data structure. I have an array of references to anonymous arrays which in turn contain a scalar as a the first item and a reference to an anonymous hash as the second item:
push @lecshun, [$barename , {package=>$gem, index=>$dexi}];
For some items in the array I want to add another key-value pair to the hash, but I just cannot figure out how to do that. I have only gotten so far:
$lecshun[$dexi - 1] ##? <<-- what to do here ?## = inv($gem);
The subroutine inv is this, although it could be anything:
sub inv { my $pkg = $_[0]; my @pki = qx{cygcheck -i --inst $pkg}; for my $ln (@pki) { next unless $ln=~/^Version\s+:\s(\S+)/; say "Pkg ".$1; return (datum => $1); } }
Maybe I am making this too complicated for myself.
Jan 16, 2025 at 02:07 UTCA just machine to make big decisions
Programmed by fellows (and gals) with compassion and vision
We'll be clean when their work is done
We'll be eternally free yes, and eternally young
Donald Fagen -> I.G.Y.
(Slightly modified for inclusiveness)
In reply to Adding a new key-value pair to a nested anonymous hash by Intrepid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |