use Algorithm::Permute; my @array = split//,"TEST"; Algorithm::Permute::permute { say @array } @array;