You can use Set::CrossProduct under the same terms as Perl itself.