Use a hash. Create a hash containing all possible letters (something like my %letters = map { $_ => 1 } "a" .. "z";) and get letters in a loop, delete'ing each used letter from the hash.
Sorry if my advice was wrong.
Comment on Re: Regex to compare (if) two strings (Uniquely - I will explain inside)