Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi PerlMonks,
here's my problem:
I have an array of less than 6 strings, and I want to print all combinations of these strings.
Ex:
@words = (nvidia,GeForce,2,MX);
this should print out:
nvidia GeForce 2 MX
nvidia 2 MX
nvidia GeForce MX
nvidia MX
nvidia 2 GeForce
nvidia MX 2
nvidia MX GeForce
GeForce nvidia
GeForce nvidia 2
GeForce nvidia MX
GeForce 2 nvidia
.
.
etc.
please help me find a solution to this, I'd be so grateful :)
-Dar
here's my problem:
I have an array of less than 6 strings, and I want to print all combinations of these strings.
Ex:
@words = (nvidia,GeForce,2,MX);
this should print out:
nvidia GeForce 2 MX
nvidia 2 MX
nvidia GeForce MX
nvidia MX
nvidia 2 GeForce
nvidia MX 2
nvidia MX GeForce
GeForce nvidia
GeForce nvidia 2
GeForce nvidia MX
GeForce 2 nvidia
.
.
etc.
please help me find a solution to this, I'd be so grateful :)
-Dar
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: printing all combinations of an array..
by tachyon (Chancellor) on Feb 20, 2002 at 00:44 UTC | |
Re: printing all combinations of an array..
by dragonchild (Archbishop) on Feb 19, 2002 at 18:57 UTC | |
by Kozz (Friar) on Feb 19, 2002 at 19:08 UTC | |
by virtualsue (Vicar) on Feb 19, 2002 at 19:28 UTC | |
by Kozz (Friar) on Feb 20, 2002 at 21:19 UTC | |
Re: printing all combinations of an array..
by YuckFoo (Abbot) on Feb 19, 2002 at 20:50 UTC | |
by Anonymous Monk on Feb 20, 2002 at 04:15 UTC | |
Re: printing all combinations of an array.. (code supplied)
by grinder (Bishop) on Feb 20, 2002 at 10:00 UTC | |
Re: printing all combinations of an array..
by Anonymous Monk on Feb 20, 2002 at 12:16 UTC |
Back to
Seekers of Perl Wisdom