| [reply] |
khaled_diaa,
You likely do not mean combinations. This is because with combinations, there is not difference between "I love you" and "you I love". So before pointing you to some modules that will make your life easier, why don't you answer a few questions:
- Do all 5 words have to be used in every sentence or can a sentence use 3 of the 5 words for instance?
- Can words only appear once, or can they be re-used?
- Do you have more than 5 words and you need to choose 5 at a time?
- etc, etc, etc
There are a number of modules that can help you solve this problem. If you had searched on CPAN for combination and/or permutation, I bet you would have gotten further than you did.
| [reply] |
You wouldn't be trying to get us to do your homework would you? :)
-guinex | [reply] |
Tip: It might be easier to put the words in an array and permute/combine the indexes of the array.
| [reply] |
"This and that and the other" from "this and that the other"? if allowed and the program is written correctly, it should loop forever ;) To put it another way and to expose the unknowns more thoroughly, you need to specify whether order of the words matters (yes=permutation no=combination) and whether words may repeat (yes=something two orders of magnitude more complicated than either!)
__________________________________________________________________________________
^M Free your mind!
| [reply] |
It would help if you showed us your code so far with a small data set (say three words) and the output you expect. It may also help if you tell us why you are doing this. At present it looks like poorly specified homework and we have an aversion to doing homework.
DWIM is Perl's answer to Gödel
| [reply] |
dear great monks, a new guy needs assistance,
You welcome! Did you use to be a gal previously? ;-)
i have been required to create a script
Required by whom? Your teacher? Your instructor? What did you try thus far?
to generate all possible cmombinations between words.
Combinations or Permutations? Or...
and by combinations i mean that if i have 5 words i need all possible sentences between those 5 words.
A sentence is a linguistics concept, and not all the of the permutations of a given list of words will give you a well formed sentence according to some grammar. Don't you think so?
the words are read from a file, i read them and place them in a 2d array
In a 2d array? And according to which criteria?
| [reply] |