Variable length array of arrays into tree structure - help



I need help figuring out how to print this properly.

I have generated an array of arrays from a csv file. Here is an example
of the data stored in the array (note: the ' - ' are just element
dividers and not actual elements. They are just text).

ADMSND70AFC.01 - Sessions - NOC-CO - AFC - 172.16.22.34
ARTHND16AFC.01 - Sessions - NOC-CO - AFC - 172.16.22.26
CAVWND48AFC.01 - Sessions - NOC-CO - AFC - 172.16.22.6
CRYSND04AFC.01 - Sessions - NOC-CO - AFC - 172.16.22.46
CVLRND10AFC.01 - Sessions - NOC-CO - AFC - 172.16.22.90
DYTNND01AFC.01 - Sessions - NOC-CO - AFC - 172.16.22.50
co-gateway - Sessions - NOC-CO - Servers - 10.70.64.33
Genview-EMS - Sessions - NOC-CO - Servers - 172.16.19.254
Mayberry (external) - Sessions - NOC-CO - Servers - 1.3.5.4
Mayberry (internall) - Sessions - NOC-INT - Servers - 172.16.18.103
OPIE2 (SUN NTP SERVER) - Sessions - NOC-INT - Servers - 172.16.18.102
10008PKRV_L - Sessions - NOC-INT - Core - Rotuers - Console -
donp:7001@xxxxxxxxxxx
10008PKRV_R - Sessions - NOC-INT - Core - Rotuers - Console -
donp:7002@xxxxxxxxxxx

What I need to do is setup printing of this data in the following tree
format:

Sessions
NOC-CO
>AFC
>ADMSND70AFC.01
>172.16.22.34
>ARTHND16AFC.01
>172.16.22.26
>CAVWND48AFC.01
>172.16.22.6
>CRYSND04AFC.01
>172.16.22.46
>CVLRND10AFC.01
>172.16.22.90
>DYTNND01AFC.01
>172.16.22.50
>Servers
>co-gateway
>10.70.64.33
>Genview-EMS
>172.16.19.254
>Mayberry (external)
>1.3.5.4
>NOC-INT
>Servers
>Mayberry (internall)
>172.16.18.103
>OPIE2 (SUN NTP SERVER)
>172.16.18.102
>Core
>Routers
>Console
>PKRV_L
>10.10.17.68
>PKRV_R
>10.10.17.68

I.E.
- '172.16.22.34' is a child of 'ADMSND70AFC.01', which is a child of
'AFC', which is a child of 'NOC-CO', which is a child of 'Sessions'.
- '10.10.17.68' is a child of 'PKRV_R', which is a child of 'Console',
which is a child of 'Routers', which is a child of 'Core', which is a
child of 'NOC-INT', which is a child of 'Session'.

I am going to place this in a XML for bookmarks for KDE Konsole. I need
to create a tree/folder structure.

The array inside the array ('row' - Sorry for calling it that, but it
fits) can be variable length.

I've been looking for some form of 'tree' function or script with no luck.

Anyone have any advice?
.