|P is for Practical|
Odd splice behavior between perl/OS versionsby SimonSaysCake (Beadle)
|on Oct 28, 2016 at 17:53 UTC||Need Help??|
SimonSaysCake has asked for the wisdom of the Perl Monks concerning the following question:
I was recently working with Perl's splice function and ran into an anomaly. In this case I was testing on Windows via WAMP running ActiveState Perl ver. v5.16.3. Everything looked good but when I ran the same code on one of our Linux severs (RedHat), this one running Perl ver. v5.10.1 (yes, it's old and someday it will no longer be), I got a different result which really surprised me. Here is the code in question and the different outputs:
On my Windows 10 workstation with Perl v5.16.3 I get what I expect:
But on the Linux box with Perl v5.10.1 I get something else:
Our other Linux server (Ubuntu) is running Perl ver. v5.14.2 and the test script's output on that box is the same as my Windows 10/WAMP output so it would seem to be, at least in part, a Perl version issue.
I searched here and Googled around and was surprised not find anything about this. The only reference to a change in splice's behavior that I found is regarding allowing it to accept an array ref for its EXPR argument starting with 5.14. That's considered experimental behavior and doesn't apply here since I've chosen not to use refs.
Any idea why the change in behavior? Bug? Thanks for any insight you can offer.-Simon