in reply to compare always true in grep

Also fails on Linux as listed previously; here perl is v5.16.3. What is your perl version on Linux?

Replies are listed 'Best First'.
Re^2: compare always true in grep
by ikegami (Patriarch) on Oct 24, 2014 at 18:52 UTC

    5.18.0 or higher. That's when

    grep(EXPR)
    become a valid equivalent to
    grep(EXPR, @empty)

      Since you mention it, could you also summarize why? Seems a bad idea to me. I mean, we have a case right here where it would have caught a mistake. What is the point of allowing people to write useless constructs, especially when it is easy to write them by accident?

      - tye        

        I agree with you. I don't know why this was done. Sounds like a case of consistency gone wrong, but maybe it's a side effect of another fix?


        Executing the following should find the commit in which this changed.

        git clone git://perl5.git.perl.org/perl.git perl cd perl ./Porting/bisect.pl --target=miniperl --start=v5.16.0 --end=v5.18.0 \ --expect-fail -e 'grep(1)'

        Until Monday, the only unix machine to which I have access is my web server, and my web host frowns on spending that much CPU. :)