in reply to How to get all combinations

Is this what you are after?

#! perl -slw use strict; use Algorithm::Combinatorics qw[ combinations ]; my @total = ( "1-S","2-S","3-S","4-S","5-S","6-S","7-S","8-S","9-S","10-S","11-S","1 +2-S","13-S","14-S", "1-H","2-H","3-H","4-H","5-H","6-H","7-H","8-H","9-H","10-H","11-H","1 +2-H","13-H","14-H", "1-R","2-R","3-R","4-R","5-R","6-R","7-R","8-R","9-R","10-R","11-R","1 +2-R","13-R","14-R", "1-K","2-K","3-K","4-K","5-K","6-K","7-K","8-K","9-K","10-K","11-K","1 +2-K","13-K","14-K" ); my $iter = combinations( [0..55], 5 ); print join ' ', @total[ @$_ ] while defined( $_ = $iter->next ); __END__ C:\test>junk2 1-S 2-S 3-S 4-S 5-S 1-S 2-S 3-S 4-S 6-S 1-S 2-S 3-S 4-S 7-S 1-S 2-S 3-S 4-S 8-S 1-S 2-S 3-S 4-S 9-S 1-S 2-S 3-S 4-S 10-S 1-S 2-S 3-S 4-S 11-S 1-S 2-S 3-S 4-S 12-S 1-S 2-S 3-S 4-S 13-S 1-S 2-S 3-S 4-S 14-S 1-S 2-S 3-S 4-S 1-H 1-S 2-S 3-S 4-S 2-H 1-S 2-S 3-S 4-S 3-H 1-S 2-S 3-S 4-S 4-H ...

If so, then your calculation is wrong. It results in 3.8 million combinations, not the 458 million that your calculation would produce.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^2: How to get all combinations
by robertw (Sexton) on Jul 07, 2012 at 00:15 UTC

    I copied the script, there seems to be something goofy with my algorithm combinatorics locations:

    #! perl -slw use strict; use lib '/opt/perl5/perlbrew/bin/perlbrew/perls/perl-5.14.0/lib/site_p +erl/5.14.0/darwin-2level' use Algorithm::Combinatorics qw[ combinations ]; my @total = ( "1-S","2-S","3-S","4-S","5-S","6-S","7-S","8-S","9-S","10-S","11-S","1 +2-S","13-S","14-S", "1-H","2-H","3-H","4-H","5-H","6-H","7-H","8-H","9-H","10-H","11-H","1 +2-H","13-H","14-H", "1-R","2-R","3-R","4-R","5-R","6-R","7-R","8-R","9-R","10-R","11-R","1 +2-R","13-R","14-R", "1-K","2-K","3-K","4-K","5-K","6-K","7-K","8-K","9-K","10-K","11-K","1 +2-K","13-K","14-K" ); my $iter = combinations( [0..55], 5 ); print join ' ', @total[ @$_ ] while defined( $_ = $iter->next );

    Combinatorics.pm:9: this one appears to be wrong: XSLoader::load('Algorithm::Combinatorics', $VERSION);

    getallcombos.pl:5: Compilation failed in require getallcombos.pl:5: BEGIN failed--compilation aborted this sentence appears to be wrong use Algorithm::Combinatorics qw[ combinations ];
    Everything is installed correctly, however it seemed in the wrong directory so I screwed something up, I think some things are out of place, would you know how I can solve this problem?

      Everything is installed correctly

      Sorry, but that is obviously not the case.

      Also, I know nothing of perlbrew or darwin (is that Apple?), so I cannot begin to suggest how to fix your installation.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?

        I have everything working, I only need to know what XSLoader::load is trying to load in the combinatorics.pm file, I had copied a file and placed it somewhere else, the references to the PM's where all wrong the only one left is what XSloader wants to load. Can you tell me which file that is? it's not about perlbrew or apple in any way it is purely misreferencing

      In the library I use there is only combinatorics.pm, I also have a combinatorics directory that contains an bundle, and a bs file which i dont refer to, this directory is located in the place it usually installs the .pm file:S, I hope this helps for clarity
        You will not be able to just copy a module with a compiled c component into your 'lib' and expect it to work. If you want to try and outsmart the Perl Dynaloader, read perldoc Dynaloader and possibly set @dl_library_path.

        I'm not really a human, but I play one on earth.
        Old Perl Programmer Haiku ................... flash japh