http://www.perlmonks.org?node_id=1020692


in reply to How can one generate all possible permutations of r elements out of n where r<n?

A very fast look on CPAN reveals Math::Combinatorics

Despite the low version number, it looks as though it does what you want, and if it doesn't the source code is probably a good starting point to modify to do it.

IIRC a lot of advice round here advises Googling and checking CPAN, because it's probably been asked before :-).

A Monk aims to give answers to those who have none, and to learn from those who know more.
  • Comment on Re: How can one generate all possible permutations of r elements out of n where r<n?

Replies are listed 'Best First'.
Re^2: How can one generate all possible permutations of r elements out of n where r<n?
by supriyoch_2008 (Monk) on Feb 27, 2013 at 09:14 UTC

    Hi space_monk,

    Thanks for the suggestions. I have used Math::Combinatorics to solve the problem of combinations of elements.

    With kind regards.