Since you're checking $divide_by for a true value (Truth and Falsehood), it's likely that $data_to_sum[0]->[$c] is empty, as LanX pointed out (Update before posting: and as you just discovered yourself). I just wanted to point out tip #4 from the Basic debugging checklist: Use Data::Dumper to see what the variables really contain (although personally I prefer Data::Dump):

use Data::Dump; dd $data_to_sum[0]->[$c], $divide_by; $data_to_sum[0]->[$c] /= $divide_by if $divide_by; print $data_to_sum[0]->[$c], "\n"; __END__ ("", 123) 0

Update: Actually, it turns out that using Data::Dump in this case might confuse the issue more, since it has an issue that causes it to silence the warning in question. So in this case, I recommend Data::Dumper, and I would recommend turning on its Useqq option (as it makes issues with control characters in the string easier to spot):

use Data::Dumper; $Data::Dumper::Useqq=1; print Dumper($data_to_sum[0]->[$c], $divide_by); $data_to_sum[0]->[$c] /= $divide_by if $divide_by; print $data_to_sum[0]->[$c], "\n"; __END__ $VAR1 = ""; $VAR2 = 123; Argument "" isn't numeric in division (/) at ... 0

Update 2019-08-17: Updated the link to "Truth and Falsehood".


In reply to Re: Argument "" isn't numeric in division (updated) by haukex
in thread Argument "" isn't numeric in division (/) by seki

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.