seki has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks
I am getting the following warning after a code refactoring where the optional divisor value passed via a parameter hashtable can be undef (because non-existent in the hashtable), even when trying to use a condition. For example
if ($divide_by){ $data_to_sum[0]->[$c] /= $divide_by; }
and
$data_to_sum[0]->[$c] /= $divide_by if $divide_by;result in the same warning. What is the correct way to do? Use a default value of 0 to make the test work?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Argument "" isn't numeric in division (/)
by LanX (Saint) on Jul 03, 2017 at 12:05 UTC | |
|
Re: Argument "" isn't numeric in division (updated)
by haukex (Archbishop) on Jul 03, 2017 at 12:13 UTC | |
|
Re: Argument "" isn't numeric in division (/)
by thanos1983 (Parson) on Jul 03, 2017 at 14:04 UTC | |
|
Re: Argument "" isn't numeric in division (/)
by seki (Monk) on Jul 03, 2017 at 12:07 UTC | |
by stevieb (Canon) on Jul 03, 2017 at 12:34 UTC | |
by LanX (Saint) on Jul 03, 2017 at 12:38 UTC | |
by stevieb (Canon) on Jul 03, 2017 at 12:45 UTC | |
by Laurent_R (Canon) on Jul 03, 2017 at 17:16 UTC | |
by afoken (Chancellor) on Jul 03, 2017 at 17:56 UTC | |
by seki (Monk) on Jul 13, 2017 at 12:51 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |