in reply to Combinations of a set of elements

for a different twist, try merlyn's range-based magical autoincrement.

#!/usr/bin/perl use strict; use warnings; $|++; my $alphaGen = sub { scalar glob "{A,B,C}{A,B,C}" }; print $_,$/ while $_ = $alphaGen->();

i figure if this is homework, you'd never get away with submitting this answer -- but you (and others) might learn this sweet little trick.

~Particle *accelerates*