c has asked for the wisdom of the Perl Monks concerning the following question:
I've been struggling with this for about an hour and I feel like I am dancing around the answer, but just not getting it. You can see I have problems understanding references...
I pass over an array in a for loop and want to stuff values into a defined hash. The hash being called is created from a value within the array
for my $i(@asnValues) { my @asnParams = split(/ /,$i); my $asnHash = "asn$asnParams[0]"; }
I'd then like to put other array values into this hash within the same for loop
$$asnHash{risk} = $queueNsp[2];
I receive the error about can't use string as hash ref while strict refs. So I tried
my $asn = "asn$asnParams[0]"; my $asnHash = \%{$asn};
but still it was a no go. Can someone please school me on the correct manner of doing this? I'll beat it into my skull by day's end.
thanks very much -c
Back to
Seekers of Perl Wisdom