in reply to Re^2: Calculate log of matrix values
in thread Calculate log of matrix values

if ($matrix[$i][$j] =~ /[^0.00]/){

This does not do what you think it does, but it is at least close. You are really only doing if ($matrix[$i][$j] =~ /[^0.]/){ IE: does the string have at least one character that is not a literal '0' or a '.'

See: Bracketed Character Classes

Why not make the test if ($matrix[$i][$j] > 0)? That's much simpler and faster, and will not fail on "-0.00 " or " 0.00" or regular negative numbers.

Replies are listed 'Best First'.
Re^4: Calculate log of matrix values
by madM (Beadle) on Aug 10, 2013 at 10:33 UTC
    thanks! you are right :)