I have a script that is reading in a two-column tab-delimited file. The first column of this file has what I will use as a key for my hash of arrays, and it is repeated many times in the file with different corresponding values, that will go into the arrays in this hash of arrays. Therefore the input file looks like:
A 1
A 2
B 4
B 6
and so on. I want my output to be something like <key><value><value> etc... for each key.
So I read the input file into a hash of arrays, being
$index{$entry} using the command
push @{$index{$entry}}, "$value" to do this, with $value being the value of the second column from the input file
What is the correct syntax to print an entrie array from the hash? I've tried
$index{$entry}@{$index{$entry}} amongst others, and I don't get what I'm expecting. Anybody have a good way to get this out?
thanks
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.