![]() |
|
Syntactic Confectionery Delight | |
PerlMonks |
generating permutationsby Anonymous Monk |
on Mar 29, 2017 at 17:20 UTC ( #1186402=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Sorry, I am very frustrated right now. I have spent the last six hours trying to come up with a simple perl program to list all permutations for the numbers from one to five (the use of cpan modules is not allowed for this exercise).
The well-known algorithm and code snippets in other languages can be found here: http://stackoverflow.com/questions/9148543/program-to-print-permutations-of-given-elements One python implementation is very brief and almost understandable (though my python knowledge is even poorer than my perl knowledge):
The biggest problem is (even after reading man perlsub for over an hour), I just don't understand the calling syntax. My attempt is looking something like this (which generates a huge number of syntax errors and won't run).
Can someone guide me in the right direction. Clever techniques are not important. What is important is that I understand what is going on. Thank you (very much) in advance.
Back to
Seekers of Perl Wisdom
|
|