Jan 15, 2006 #1 PerlElvir Technical User Joined Aug 23, 2005 Messages 68 Hi all, can someone help me to make this script with combination, because Im begginer ). I have : a1 a2 a3 and b1 b2 b3 so I need script which will make all combination: a1:b1,a1:b2,a1:b3,a2:b1,a2:b2...
Hi all, can someone help me to make this script with combination, because Im begginer ). I have : a1 a2 a3 and b1 b2 b3 so I need script which will make all combination: a1:b1,a1:b2,a1:b3,a2:b1,a2:b2...
Jan 15, 2006 #2 Corwinsw Programmer Joined Sep 28, 2005 Messages 117 Location BG my @arr1 = (a1,a2,a3); my @arr2 = (b1,b2,b3); foreach my $var1 (0 .. $#arr1) { foreach my $var2 (0 .. $#arr2) { print "$arr1[$var1], $arr2[$var2]\n"; } } Corwin Upvote 0 Downvote
my @arr1 = (a1,a2,a3); my @arr2 = (b1,b2,b3); foreach my $var1 (0 .. $#arr1) { foreach my $var2 (0 .. $#arr2) { print "$arr1[$var1], $arr2[$var2]\n"; } } Corwin
Jan 16, 2006 Thread starter #3 PerlElvir Technical User Joined Aug 23, 2005 Messages 68 thx dude ) Upvote 0 Downvote
Jan 16, 2006 #4 ishnid Programmer Joined Aug 29, 2003 Messages 1,422 Location IE If it gets more complicated (i.e. more than two lists), you may want to look at the Math::Combinatorics module. Upvote 0 Downvote
If it gets more complicated (i.e. more than two lists), you may want to look at the Math::Combinatorics module.
Jan 16, 2006 Thread starter #5 PerlElvir Technical User Joined Aug 23, 2005 Messages 68 this is good one thank you dude Upvote 0 Downvote