Thanks for your help. My PI doesn't want me to use any other modules other then the default ones that come installed with perl, so I can't use List::Util. I already have the the column assigned to a 1D array on line 121, but I believe it is all referenced. If I try to use this sub with a passed in @col, the total is calculated incorrectly.
sub score_count {
my @arr = shift;
my $total = 0;
foreach my $score (@arr) {
print "@$score "; ##prints actual values; If @ taken out,
+values printed are like ARRAY(0x95533e0)
$total += @$score; ##if @ is taken out the summation is somewhe
+re ~140915576; however, with the @, the values are still incorrect.
}
print "$total\n";
return $total;
}
Are you suggesting to not even use the column slice so it's a 1D array?
Thanks for letting me know about if construct issue but I do want to skip the line if it is false so that code should be correct.
Thanks for the help
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.