note
BrowserUk
<blockquote><i>fatality (after a couple of warnings) for an empty input array</i></blockquote>
<p>So don't do that :)
<p>Test before entering the loop:<code>
( my $i = $#a ) > 0 or die;
$b[ $i ] = $a[ $i ] + $a[ --$i ] while $i;
</code>
<p>Never do in a loop, what can be done outside of it.
<p>Wouldn't your version fail for an array with one element?
<div class="pmsig"><div class="pmsig-171588">
<hr />
<font size=1 >
<div>With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'</div>
<div>Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.</div>
<div>"Science is about questioning the status quo. Questioning authority". [http://www.theregister.co.uk/2016/11/02/complexity_in_it/|The enemy of (IT) success is complexity.]</div>
<div>In the absence of evidence, opinion is indistinguishable from prejudice.
<span>[https://www.theregister.co.uk/2017/04/10/mark_shuttleworth_says_some_free_software_contributors_are_deeply_anti_social/|Suck that fhit]</span> </div>
</font>
</div></div>
1214667
1214740