http://qs321.pair.com?node_id=17977


in reply to permutations?

You say that order is unimportant, but do you mean that the sentences can be in any order at all? You're using a hash reference to store the keys 'lng', 'sentance', and 'thxs', but hashes don't preserve any order whatsoever, so you're likely not going to get the keys in the same order you entered them into $words. If you want to keep the sentence parts in the same order, you might want to instead make it an array reference
my $words = [ ['lang', 'long', 'leng', 'loo'], ['sentence'], ['this', 'thus'] ];

Replies are listed 'Best First'.
RE: Re: permutations?
by eduardo (Curate) on Jun 14, 2000 at 00:44 UTC
    the order of the words isn't important at all, as long as one word from every key becomes part of each candidate answer... and unfortunately they are being passed to me as a hash of lists, so, i have to deal with them that way. (from another object) however, in the answer i can definetly mangle it any way we see fit...