in reply to emptying a hash into a spreadsheet
While I'm not a Spreadsheet::WriteExcel expert, I would expect that write_col() writes a column. But, you're writing a bunch of stringified reference names, not a column of values.
It looks like you have a 2-D array and you're not thinking it through. Try something like:
In other words, transform your width-first group of arrays into a group of depth-first arrays, then write them out. (I hope I got the write_col() syntax correct.)# COMPLETELY UNTESTED!!! my @values; foreach my $hash_count (sort { $a <=> $b } keys %hash) { foreach my $i (0 .. $#{$hash{$hash_count}}) { push @{$values[$i]}, $hash{$hash_count}[$i]; } } foreach my $i (0 .. $#values) { $worksheet->write_col($i + 1, 1, $values[$i]); }
------
We are the carpenters and bricklayers of the Information Age.
The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
|
|---|