in reply to compare always true in grep

The problem is that you used the following grep:

grep((0 + $_) >= 99999999)

You meant to use the following grep:

grep(((0 + $_) >= 99999999), @times)

Be careful when you omit parens around arguments.


You must have had different code on your linux system. Side-effects aside,

if (EXPR, @times) { ... }
is the same thing as
if (@times) { ... }
on all platforms.

Note that

grep(EXPR)
was a syntax error before 5.18. In 5.18, it was changed to be equivalent to
grep(EXPR, @empty)

The mentions of a syntax error by the other posters is not relevant to the question; they're simply using an older version of Perl than the versions present on each of your systems.

Replies are listed 'Best First'.
Re^2: compare always true in grep
by RonW (Parson) on Oct 24, 2014 at 19:13 UTC

    Apparently, the Perl on the Linux PCs is even older. I won't be able to check until sometime tomorrow because they are busy running robots.

    Anyway, adding parens around the arguments fixed it.

    Thanks