Very nice. I tried several times without success to come
up with a good non-recursive solution. The above not only
is short, but it really does the binary search, and
applying standard golfing techniques, it comes up a
winner at 55:
sub f{
($s,$t)=@_;$t=$$t{$$t{d}gt$s?l:r}while$t&&$$t{d}ne$s;$t
}
(Or 57 if you add
my to kill side effects. Still
better than anything I thought of.)
Note that this is much less readable than what tye
wrote, but every transformation is fairly mechanical
compression of the code...