$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 reply to Re^2: Abusing Map
by AnomalousMonk
in thread Abusing Map
by writch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |