http://www.perlmonks.org?node_id=439603


in reply to help with hashes

If you are generating the lists, you can also use some type of combination module such as Math::Combinatorics.
use Math::Combinatorics; my @aminoacids = qw(Tyrosine Glycine Leucine); print join("\n", map { join " ", @$_ } permute(@aminoacids)),"\n";