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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.