in reply to A "harmless" alternative to 'map{}'?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: A "harmless" alternative to 'map{}'?
by Juerd (Abbot) on Sep 09, 2002 at 06:48 UTC | |
by Arien (Pilgrim) on Sep 09, 2002 at 07:11 UTC | |
by Aristotle (Chancellor) on Sep 09, 2002 at 12:39 UTC | |
by shotgunefx (Parson) on Sep 09, 2002 at 12:45 UTC | |
by Aristotle (Chancellor) on Sep 09, 2002 at 12:55 UTC | |
|