Yannik Lefebvre wrote: > Exemple: i have a list of numbers ( 1 - 2 - 3 - 4 -5) > > i need to find all possible combination from that list > > 1 > 12 > 123 > 1234 > 12345 > 13 > 134 > 1345 > > etc.... > > Thank u all!
i found your problem insteresting! the following should solve it: #!/usr/bin/perl -w use strict; my @i = (1..5); list_all_com(@i); sub list_all_com{ my @numbers = @_; for(my $i = 0; $i<@numbers; $i++){ print $numbers[$i],"\n"; for(my $j=$i+1; $j<@numbers; $j++){ for(my $k=$j; $k<@numbers; $k++){ print @numbers[$i,$j..$k],"\n"; } } } } __END__ prints: 1 12 123 1234 12345 13 134 1345 14 145 15 2 23 234 2345 24 245 25 3 34 345 35 4 45 5 hope you understand how it works. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]