I'm a beginner. I have a problem were I have a spreadsheet and I put the values of the spreadsheet in a Hashes of Arrays. For example:
spr.xls
empolyee Buffalo Cleveland
Terry 5.00 2.00
Doug 4.00 3.00
Fred 1.00 5.00
So I read the spread and like I said I put the values in Hash of Arrays like this:
$employee=$infor[ 0 ];
shift @infor;
$sheet{$employee}={data => [@infor]};
So, I keyed the hash by employee name and the value is a reference to an array of info Then I can print all the values like this:
foreach (keys $sheet){
print "\n$_ @{$sheet{$_}->{data}}";
}
and it prints:
Fred 1.00 5.00
Terry 5.00 2.00
Doug 4.00 3.00
empolyee Buffalo Cleveland
but I want to get access to the columns and rows so I can print the total of all the columns and rows and the output
would be like this:
empolyee Buffalo Cleveland Total
Terry 5.00 2.00 7.00
Doug 4.00 3.00 7.00
Fred 1.00 5.00 6.00
Total 10.00 10.00 20.00
my question is how can I get access to the Buffalo column or Terry row so I can add up for the totals?
thanks for the help
Edit by castaway - added code tags
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.