How to set number of for loops dynamically in Expect?

Ariel.Burbaickij_at_web.de
Date: 05/28/04


Date: 28 May 2004 14:58:47 -0700

Hello dear forum participants,
I tinker around with some legacy hierarchically
organized database which is for sure inherently
interactive. Interface looks like something like this:

1.Option
 1.1Suboption
 1.2Suboption
 1.3Suboption
 1.4Suboption
 1.5Suboption
2.Option
 2.1 Suboption
 2.2 Suboption
 2.3 Suboption
3.Option
 3.1 Suboption
 3.2 Suboption
 3.3 Suboption
 3.4 Suboption
4.Option
 4.1 Suboption
 4.2 Suboption
 4.3 Suboption
 4.4 Suboption
 4.5 Suboption
 4.6 Suboption

What this picture tries to show is that I do not know in advance
how many suboptions are under each option. What I would like to do
is to extract the information out of the legacy database using expect
and put it in something more easily manageable. For this i would prorbably
need 2 for loops one for options level and one for suboptions level.
Suboptions are presented to the user as soon as she enters the option.
Now my question:
Is it possible in expect to set the number of inner for loops (suboptions level)
dynamically based on the number of suboptions presented?
I hope I have presented the case in clear fashion.
I would be glad to answer any additional questions if clarification
is needed.

With Best Regards
Ariel Burbaickij