Solved

# calculating number combinations in perl

Posted on 2009-07-07

I have a small problem. I am working on a probability solution.

I have quasi-randomly generated data sets, from the value of 1 to 999. These values are the end result of another mathematical process.

The data comes out in groups of seven, eight and ten.

We have a mid range of 501-550.

If I could get help on the seven group problem, Im sure I could find my way with the other two groups when I can see the code structure.

I need to build a database (which could be a text file if it is big enough) of all possible value combinations, so out of the 50 numbers, from 501 to 550.

So the first possible combination would be

501,502,503,504,505,506,507

Then the next possible combination would be

501,502,503,504,505,506,508

And the combinations would tick up one at a time until

544,545,546,547,548,549,550, which would be the final one.

I expect about 10 million results.

I need each individual result output to a text file / word pad one line at a time, delineated by a comma.

Could you tell me perl code which would do this ?

Thankyou very much