in reply to Re: Anagrams & Letter Banks
in thread Anagrams & Letter Banks
Thank you, Discipulus. I need clarification on at least a couple of things. If (allo mallo malo) is a list, why does it appear to be a scalar with my $good?
Also, with regard to the %chars hash, are you saying that a new hash is made for each word in the list, and that the keys of that hash are the individual characters in the word? And after it's parsed a whole word, the value corresponding to a key is the number of times it occurs? (Does the ++ make that happen? I guess I'm not seeing how the values are added to the hash.) So then this works by looking at the number of keys, which would match the length of the word if and only if the word had no repeated letters.
Also, with regard to the %chars hash, are you saying that a new hash is made for each word in the list, and that the keys of that hash are the individual characters in the word? And after it's parsed a whole word, the value corresponding to a key is the number of times it occurs? (Does the ++ make that happen? I guess I'm not seeing how the values are added to the hash.) So then this works by looking at the number of keys, which would match the length of the word if and only if the word had no repeated letters.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Anagrams & Letter Banks
by Discipulus (Canon) on Oct 27, 2017 at 21:15 UTC |
In Section
Seekers of Perl Wisdom