On Sat, May 3, 2008 at 6:44 PM,  <[EMAIL PROTECTED]> wrote:
snip
>  The output should include '1 2 3'.
>  Therefore I want the output to be
>
>  1 2 3
>  1 6 7
>  4 5 10
>
>  It should include '1 2 3' because '1 2 3',  '1 2 4', '1 2 7',  '1 2 8', '1
> 2 9' = '1 2'(the common number from the list) + anynumber.
snip

Are you certain that the strings will always come in a sorted order
(i.e. never like "1 3 2")?  If so you can speed up the code
significantly by using a trie: Tree::Trie*.

* http://search.cpan.org/dist/Tree-Trie/Trie.pm
-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to