in reply to compare always true in grep
My 5.18.2 on Linux dies the same way. B::Deparse shows this interpretation of your if statement:
Note the parentheses. That is, you have a scalar comma expression with the grep and the @times array, which evaluates to @times. The grep is evaluating the expression 0 + $_ >= 9999999 on an empty list, but that's irrelevant.if (grep((0 + $_ >= 99999999)), @times) {
Adding the parentheses properly works:
if (grep (((0 + $_) >= 99999999), @times)) { ... # prints: Times: 1 2 3 4
|
---|