jhuijsing has asked for the wisdom of the Perl Monks concerning the following question:
I have Tree:Trie created when I do a prefix search I am not getting the response I expect
here is the trie
0 Tree::Trie=HASH(0x600d98df8) '_DEEPSEARCH' => 3 '_END' => '' '_FREEZE_END' => 0 '_MAINHASHREF' => HASH(0x600d99050) '+' => HASH(0x600d9cfa8) 6 => HASH(0x600d9d0c8) 1 => HASH(0x600d9d008) '' => 'Term' 1 => HASH(0x600d9d2d8) 4 => HASH(0x600d9d188) 1 => HASH(0x600d9cea0) 1 => HASH(0x600d9d200) '' => 'Outleg_1' 0 => HASH(0x600d9d170) '' => 'Outleg_2' 5 => HASH(0x600d9d458) '' => 'Term_Ref' 'd' => HASH(0x600d9d0b0) 'e' => HASH(0x600d9d260) 'f' => HASH(0x600d98f78) 'a' => HASH(0x600d9d578) 'u' => HASH(0x600d983d8) 'l' => HASH(0x600d9d5a8) 't' => HASH(0x600d9d5d8) '' => 'Unknown'
x $trie->lookup( "+6114110" )
0 '+6114110'
x $trie->lookup( "+61141102" )
empty array
I was expecting to get the same result, As it is the best prefix that matches
Or I have got it wrong?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A question a Tree::Trie
by Anonymous Monk on Oct 18, 2017 at 06:11 UTC | |
by jhuijsing (Acolyte) on Oct 18, 2017 at 06:57 UTC | |
by Athanasius (Archbishop) on Oct 18, 2017 at 07:22 UTC | |
by jhuijsing (Acolyte) on Oct 18, 2017 at 09:15 UTC |