bisimen has asked for the wisdom of the Perl Monks concerning the following question:
Say I have an array with a string of random characters
$length = 2; @array = "BEBEBEHUHUHUJJFAFALL";
Then I basically want a code that counts words. It can be words with a length of 2, 3 etc.
So, for the above code, I look for words with a 2 character length, and I'd like to get an output like this
Found: BE 3 HU 3 JJ 1 FA 2 LL 2
I know you can use hashes, and they have the words be the key or something, then count from there... but I'm lost and I don't know what to search for...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Counting words
by toolic (Bishop) on Nov 04, 2017 at 17:49 UTC | |
by bisimen (Acolyte) on Nov 04, 2017 at 18:09 UTC | |
by Laurent_R (Canon) on Nov 05, 2017 at 00:17 UTC | |
|
Re: Counting words
by johngg (Canon) on Nov 05, 2017 at 11:40 UTC | |
|
Re: Counting words
by davido (Cardinal) on Nov 04, 2017 at 18:39 UTC | |
|
Re: Counting words
by 1nickt (Canon) on Nov 04, 2017 at 18:27 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |