in reply to Re^2: Longest String Matching
in thread Longest String Matching

Thanks; Maybe my solution is better than I first thought! :-)
A Monk aims to give answers to those who have none, and to learn from those who know more.

Replies are listed 'Best First'.
Re^4: Longest String Matching
by hdb (Monsignor) on Apr 08, 2013 at 12:17 UTC

    Adding the empty string to the lexikon allows the following shortening:

    $lookup{''} = 1; substr($word, 0, 1) = "" while !exists $lookup{$word};