You want Algorithm::Combinatorics.
In reply to Re: How to get all combinations by tobyink in thread How to get all combinations by robertw