in reply to Re: Abusing Map
in thread Abusing Map
$b[ $i ] = $a[ $i ] + $a[ --$i ] while $i;
Except that crashes with a "Modification of non-creatable array value attempted ..." fatality (after a couple of warnings) for an empty input array. I've only visually examined them, but all the preceeding for-loop and map (and even grep!) solutions seem as if they would handle empty arrays gracefully. But
$b[ $i ] = $a[ $i ] + $a[ --$i ] while $i > 0;
avoids the problem.
Give a man a fish: <%-{-{-{-<
In Section
Seekers of Perl Wisdom