in reply to Odd splice behavior between perl/OS versions

The behavior depends on the order in which different parts of the operation are done. If this were C code, then it would be labeled "undefined behavior". Since it is Perl code, the strict meaning of that phrase from the C standard doesn't quite apply. But it is the type of behavior that is the most likely to end up changing when mundane maintenance is done on Perl's source code, including optimizations.

I believe the crux of the difference is whether you get the value of $#stuff passed to the outer instance of splice from before or after the inner instance of splice has removed $stuff[3]. Though I can also imagine more complex ways that a simple optimization, bug fix, or just reworking of Perl's code could cause your code to behave differently.

Avoid changing @stuff in multiple ways in a single expression and using values like $#stuff from within an expression where that value is changed.

- tye