Sunday, 9 December 2012

A Look at Cartesian Products

Copyright 2012 by Shawn H Corey. Some rights reserved.
Licence under CC BY-SA 3.0

Problem: You have a number of sets and you want all the combinations when choosing one element from each set.

In mathematics, these combinations are called the Cartesian product. They are also known as cross-products. In the database world, they are sometimes called cross-joins.

This article is to show how to create them using Perl's glob function and how to create them in a subroutine.