in reply to creating all possible random 'words' from 4 letters

Hi monks

I found this method from John Krahn who posts on some other Perl lists. It takes letters in any order and does the permutations.

Chris

#!/usr/bin/perl use strict; use warnings; my @letters = qw /W A C K Y/; my $pairings = 2; for (0..@letters**$pairings-1) { my @combs; do {unshift @combs, $_ % @letters} while $_ = int $_ / @letters; unshift @combs, (0) x ($pairings - @combs); print "@letters[@combs]\n"; }