Today I was bitten by a stupid mistake:
push @ary, "foo" unless grep { "foo" } @ary;
What I meant was of course:
push @ary, "foo" unless grep { $_ eq "foo" } @ary;
Would it be reasonable for me to expect perl, in the first case, to emit a warning. Say something like "Probably useless use of a constant in grep block"?
In reply to "Useless use of a constant" in grep block? by perlancar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |