in reply to Re^3: retain longest multi words units from hash
in thread retain longest multi words units from hash

> but doesn't impose a predetermined maximum word length on the hash keys.

That was my intention. I could have easily dynamically added a new level of slice if needed, but the check would have cost time. OTOH it's very likely the OP can assume a maximum word length, which is still very cheap if generously chosen.

> I also optimize by skipping single-word hash keys.

Again I thought checking for single words might cost more than just deleting an empty slice.

I have to admit I could have put the body of partitions() into the delete-slice , but preferred clarity here and left optimization to the OP.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

  • Comment on Re^4: retain longest multi words units from hash