... used or instead of an if-statement because, when using grep, he had to.
No, s/he didn't "have" to.
print "$_\n" for grep { if ($_%2) {$a=1} else {$a=0} $a } 1..10;
Yes, it's uglier, but possible.
In reply to Re^2: Unable to Understand grep and hash use for prime no.
by Anonymous Monk
in thread Unable to Understand grep and hash use for prime no.
by shankonit
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |