i am sorry if some has already posted this. why grep behaves differently , when we use expression and using the output of the expression directly in the place of expression
my $t = 1; print grep {$t^=1} qw( a b c d e );
and using 0 directly instead using expression $t^=1 below
my $t = 1; print grep {0} qw( a b c d e ); my $t = 1; print grep {$t} qw( a b c d e );
20090717 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips
In reply to grep function usage by rgadireddy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |