in reply to CPAN module to return successive combinations of n things taken k at a time

Why don't you look yourself? Its easy... :)

This search permutations cpan iterator produces plenty of candidates.

The first hit Algorithm::Combinatorics has combinations() which sounds like your requirement.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)

PS: Je suis Charlie!

update

See also cpan combinations next using words from your post.

  • Comment on Re: CPAN module to return successive combinations of n things taken k at a time
  • Download Code

Replies are listed 'Best First'.
Re^2: CPAN module to return successive combinations of n things taken k at a time
by ibm1620 (Hermit) on Feb 26, 2015 at 04:22 UTC
    Actually, Charlie, I did look, but I ended up in a mathematics section that was completely over my head. Neither the word "permutations" nor "iterator" occurred to me. But thanks for the link.
      For the record:
      #!/usr/bin/env perl use strict; use warnings; use 5.010; use Algorithm::Combinatorics qw(combinations); my @data = qw(a b c d e); # scalar context gives an iterator my $iter = combinations(\@data, 3); while (my $p = $iter->next) { say (join '', @$p); }
      Produces:
      abc abd abe acd ace ade bcd bce bde cde
      As required.
      > Neither the word "permutations" nor "iterator" occurred to me.

      Dear Bill, please see my update.

      The results are even better. :)

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)

      PS: Je suis Charlie!