for my $k (@hand) { push(@ch,$k); for my $lst (@ch) { push (@ch, $k.$lst) if index($lst,$k)==-1; } }