in reply to Two dimentional array
This seems like homework, so I'll be vague. Try doing this with three for loops. The outermost loop interates through the As and the innermost loop iterates over the Cs.
There's probably a better (more effecient) way to do this, but until I've had some coffee, this is what's coming to mind. You may also want to try the Permute modules on CPAN.