in reply to Re: grep usage confusion
in thread grep usage confusion

No, grep doesn't eval strings of Perl code. You can give it a block or you can give it an expression (not a string). Your first example does the same thing as the original code (which does work) while your second example returns all of @coins since the string '$_ ne "fourthy"' is a true value.

- tye        

Replies are listed 'Best First'.
Re^3: grep usage confusion (eval)
by rovf (Priest) on Oct 15, 2008 at 08:33 UTC
    grep doesn't eval strings of Perl code.

    Oops, you are right! My mistake!

    as the original code (which does work)
    Thanks for pointing that out. Interesting. I was not aware of that usage of grep (always used it with a block).

    -- 
    Ronald Fischer <ynnor@mm.st>