|
|
| Perl: the Markov chain saw | |
| PerlMonks |
Re: grep { } positional number of elementby Your Mother (Archbishop) |
| on Oct 23, 2022 at 21:23 UTC ( [id://11147615]=note: print w/replies, xml ) | Need Help?? |
|
grep only goes through the actual elements of whatever is passed to it. No index is passed. You might want something like–
But that is *atrocious* style. grep is for filtering, not iterating. Use a for loop instead. Terse postfix version, you should generally prefer the expanded with a block–
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||