in reply to Re: Ternary in void context
in thread Ternary in void context

As of Perl 5.8.1 (and confirmed in perldelta for 5.8.1), map is now smart enough to avoid creating that throw-away list if invoked in void context.

So the efficiency issue in using map in a void context being gone (in Perl 5.8.1 and later), the remaining issue is that of style, clarity, and convention.

grep, backticks, and the trinary operator are still examples of where a return-value is still generated regardless of context, and thrown away in void context.


Dave


"If I had my life to live over again, I'd be a plumber." -- Albert Einstein