In short: Level4 calls Level5 only one time, always! This means 4 returns to Level3 immediately after 5 returns.
And Level3 calls Level4 for the second time, but now with $perm="ab"."d" .
I hope it's clearer now, have a look at the extensive explanations in my other replies, especially the nested loop analogy.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re^3: Please help me understand this permutation sub?
by LanX
in thread Please help me understand this permutation sub?
by mdunnbass
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |