Syntactic Confectionery Delight | |
PerlMonks |
Re^7: (Mis)Understanding "works"by tye (Sage) |
on Feb 25, 2009 at 18:27 UTC ( [id://746336]=note: print w/replies, xml ) | Need Help?? |
Frankly, that is more bizarre. You jumped from "grep works on lists and arrays" to "grep works on lists in the normal way and does something completely different to arrays"? But if your worry was that someone rather magically thought that grep on an array removes things from the array, then why did you demonstrate a lack of optimization rather than demonstrating that grep doesn't modify the array? In any case, I don't think your point was well understood (which doesn't surprise me). I think you would have been more helpful had you responded differently to the slightly redundant but not incorrect inclusion of "and arrays" which likely shows a leak of or bow to the common false dichotomy between "list" and "array" in Perl. Rather than elevate this false dichotomy to the point of "works on arrays" means "does something /different/ with arrays", you should have just noted that "grep works on lists. an array can be used as a list". That is, push back against the false dichotomy. grep works on lists. So, of course, it also works on arrays (which are a type of list). Bizarre consequences of optimizations of foreach seem particularly unenlightening to, more distracting from that point. - tye
In Section
Seekers of Perl Wisdom
|
|