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
In reply to Re^2: grep usage confusion (eval)
by tye
in thread grep usage confusion
by adrive
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |