in reply to Re^2: Getting combinations from a number's digits
in thread Getting combinations from a number's digits
Ok, that's a better question. Still no code, but maybe this will get you started:
use warnings; use strict; use Algorithm::Loops qw(NextPermute); my $number = '123'; my @digits = split //, $number; my @array = ($number); # Add the first permutation push @array, join '', @digits while NextPermute (@digits); print "@array";
Prints:
123 132 213 231 312 321
|
|---|