On Fri, 25 Feb 2022 19:20:01 +0100, David Nicol <davidnicol@gmail.com> wrote: >> Compare: >> >> my @trimmed = map trim, @strings; # trim called in array context >> >> my @trimmed = map { trim( my $trimmed = $_ ); $trimmed } @strings; # trim called in void context > > Is it set in stone yet that trim takes only one arg (has a ($) prototype)? > > Compare: > > my @trimmed = trim @strings; # handling multiple arguments is orthogonal to in-place or not I appreciate the question, but this is a good example of not thinking far enough in terms of UX. :) Even if we were to "optimize" list processing into a list argument call, that was a standin, because list processing has many shapes. my @filtered = map { preserve_spaces($_) ? $_ : trim $_ } @strings; my @filtered = map { preserve_spaces($_) ? $_ : do { trim( my $trimmed = $_ ); $trimmed } } @strings; -- With regards, Christian WaldeThread Previous | Thread Next