use Algorithm::FastPermute; my @c = 'a'..'c'; permute {print "@c\n"} @c; __END__ a b c a c b c a b b a c b c a c b a