This was recently asked at All possible number combinations in perl.
In reply to Re: Combinations of array? by ambrus in thread Combinations of array? by dagwood00