in reply to testing for numerical equality
Another problem you might be having is that it's very hard to check for equality with floating-point numbers with any consistency, because of strange rounding errors. If you always want to use 3 digits to the right of the decimal point, multiplying the numbers by 1000 and storing them as integers might give you better consistency. For example:if ($found[0] == $short_nums[$i]) { push @new_array, $nums[$i]; last; }
@short_nums = (99, 68, 86, 24); ... if (int($found[0]*1000) == $short_nums[$i])
|
|---|