Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: CPAN module to return successive combinations of n things taken k at a time (NestedLoops)by tye (Sage) |
on Feb 26, 2015 at 04:14 UTC ( [id://1117904]=note: print w/replies, xml ) | Need Help?? |
Not obvious, but probably how I'd do it just because I wouldn't have to think about it. And I'm sure somebody else will soon point out a combinations module that has a version of 'pick' built in already.
Update: Oh, you didn't say whether or not you wanted "with replacement". It is slightly simpler with replacement:
Update: I decided to combine the two and support shortcuts on the command-line. Code available via the "Select" (or "Download") link.
- tye
In Section
Seekers of Perl Wisdom
|
|