Dear Wise Ones,
I've written a bit of code that opens a tab delimited text file, parses it, and stuffs it into an array of anonymous hashes. This works fine.
And while I can access any single value form any hash in the array with
$arrayOfHashes[$i]]{$key}
I'm having trouble plucking one of those anonymous hashes from the array and putting it into its own hash. The following bit of code does not work
my %tempHash = $arrayOfHashes[0] ;
my @tempKeys = keys %tempHash ;
nor does
my @keys= keys @arrayOfHashes[$i]
I get the error:
Reference found where even-sized list expected
Whats the trick to plucking one entire hash from an array so that I can store it in its own hash or use hash functions (such as
keys on it?
- Paul
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.