I tried running your example code using perl 5.10.1 and got following output...
Interesting. Experimenting with the Strawberry Perl versions I have on my system, it appears the change occurred between Perl 5.12.3 and 5.14.4. Running with -MO=Deparse reveals only one difference:
&Switch::switch(); # v5.12.3 vs. &Switch::switch(()); # v5.14.4
And calling switch explicitly with an empty list — switch(()) — under 5.12.3 gives the same result as calling switch() under 5.14.4.
I’ve skimmed through the deltas, but so far haven’t found a plausible explanation. Possibly related to the change in handling the (;$) prototype,1 since that is the prototype of sub switch in the Switch module, but I don’t see how that would account for the observed behaviour. :-/
1See “Change in parsing of certain prototypes” in perl5140delta.
Cheers,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re^3: Perl Code Changes Behavior if Two Subroutine definitions are swapped
by Athanasius
in thread Perl Code Changes Behavior if Two Subroutine definitions are swapped
by rkabhi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |