Hello,
I have a hash that points to values in an array like this:
key1 -> 1 2 3 4 5 6 7 8
key2-> 4 6 7 8 3 2 9 7
key3-> 2 3 5 8 9 1 1 2
I can print out the values like this:
for my $hash_count ( sort {$a<=>$b} keys %hash){
print "($hash_count)-> @{$hash{$hash_count}}\n";
}
I really want to empty this data into a spreadsheet using the Spreadsheet::WriteExcel module.
I hoped the following might work but it doesnt:
for $hash_count ( sort {$a<=>$b} keys %hash){
push @spread_array,"$hash{$hash_count}";
}
$worksheet->write_col(1,1,\@spread_array);
The idea was to push a load of references to arrays into @spread_array.
Can anyone help with getting a hash of arrays into a spreadsheet ? I know 2D arrays can be written in one go.
thanks,
basm101
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.