if r > 3 or so, tye's solution is good for more general cases.my @arr = (1..100); foreach my $i (0..@arr-1) { foreach my $j (0..@arr-1) { next if $i == $j; print "$arr[$i],$arr[$j]\n"; } }
-Mark
In reply to Re: Searching for a Permutation Algorithm for nPr where n != r
by kvale
in thread Searching for a Permutation Algorithm for nPr where n != r
by ozboomer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |