It works with
#!/usr/bin/perl
use strict 'vars';
use strict 'subs';
use strict 'refs';
use Math::Combinatorics;
my @a = (["a",],["b",],["c",],["d",], ["e",]);
print "[EMAIL PROTECTED]:\n\n";
my @b = combine(4,@a);
foreach my $ref (@b) {
print @{$ref} ."\n"; ###### here is the difference.
}
-----Message d'origine-----
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] la part de Ying
Yang
Envoy� : mardi 2 novembre 2004 16:15
� : [EMAIL PROTECTED]
Objet : Incomplete combinatorics
Dear All:
I need to do combinatorics and downloaded the perl module
combinatorics.pm (Math-Combinatorics-0.02.tar.gz) from CPAN
http://www.cpan.org/modules/01modules.index.html .
I tried a very simple test case:
----------------------------------------
#!/usr/bin/perl
use strict 'vars';
use strict 'subs';
use strict 'refs';
use Math::Combinatorics;
my @a = (["a",],["b",],["c",],["d",], ["e",]);
print "[EMAIL PROTECTED]:\n\n";
my @b = combine(4,@a);
foreach my $ref (@b) {
print "@$ref\n";
}
----------------------------------------
On ActivePerl installed on Windows XP, however, incomplete results are
produced. Combining 4 out of 5 elements should give you 5 alternatives,
while ActivePerl only gives 3 alternatives.
----------------------------------------
ARRAY(0x2251d0) ARRAY(0x2252a8) ARRAY(0x1824430) ARRAY(0x184f9b0)
ARRAY(0x184fae8):
ARRAY(0x2251d0) ARRAY(0x2252a8) ARRAY(0x1824430) ARRAY(0x184f9b0)
ARRAY(0x2251d0) ARRAY(0x2252a8) ARRAY(0x1824430) ARRAY(0x184fae8)
ARRAY(0x2251d0) ARRAY(0x2252a8) ARRAY(0x184f9b0) ARRAY(0x184fae8)
----------------------------------------
I have tried the same codes on Linix (simulator: cygwin). 4 alternatives
are produced, which is still incomplete:
----------------------------------------
ARRAY(0x10111190) ARRAY(0x101112c8) ARRAY(0x1015d328) ARRAY(0x1013a84c)
ARRAY(0x1013a870):
ARRAY(0x10111190) ARRAY(0x101112c8) ARRAY(0x1015d328) ARRAY(0x1013a84c)
ARRAY(0x10111190) ARRAY(0x101112c8) ARRAY(0x1015d328) ARRAY(0x1013a870)
ARRAY(0x10111190) ARRAY(0x1013a84c) ARRAY(0x1015d328) ARRAY(0x1013a870)
ARRAY(0x101112c8) ARRAY(0x1013a84c) ARRAY(0x1015d328) ARRAY(0x1013a870)
-----------------------------------------
Can anyone tell me why? Thanks a lot,
Ying
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs