How about wrapping it in a sub, thusly?
sub new_lamps_for_old (\@) { my $old; map { $old = $_; $_ = Lamp->new(); $old; } @{$_[0]}; }
The prototype is used to guarantee that the map acts on lvalues.
I have been known to propose placing map in void context when modifying its arguments, just to call attention to the fact. I didn't really mind losing on that proposal.
After Compline,
Zaxo
In reply to Re: A "harmless" alternative to 'map{}'?
by Zaxo
in thread A "harmless" alternative to 'map{}'?
by graff
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |