in reply to Re^7: modify the contents of an array
in thread modify the contents of an array
They're the same, except one is more confusing to read, because most people expect it's return type to be used.map { s/// } @array; # ... s/// for @array;
Just because larry likes something is not a reason everyone should be following him (we should all be blindingly following Perl Best Practices instead ;-), but map in void context has no advantage over for, but does add an element of confusion (did the author mean to assign to a result array? did the author not know about for? am I reading this badly? let me go up one line and see if it's a multi line assignment statement).
Optimizing for readability is universal good style.
|
|---|