Perl Programming Assist Please

I’m going crazy here, my brain apparently fried from the weekend or the water or something, looking for some perl assistance from my perl-knowledgeable buds (you know who you are… šŸ™‚

I’m creating a menu system and converting entries in a database into a perl data structure that I can then parse to create an HTML menu. I’m having a real problem with the first part. I want to take a list of strings such as:


/about/contact

/about/contact/map

/about/contact/email

/about

/products

/products/style1

/products/style2

/products/widgets

/products/widgets/foo

/products/widgets/bar

/products/widgets/baz

/products/widgets/baz/qux

(The strings can have infinite depth (not restricted to 3 or 5 sub-levels) and is dynamically pulled from a database.)

I want to take this and convert it into a datastructure such as this one here (which is part of HTML::Widgets::NavMenu).

The gory details are a bit…. gorier. The strings are just an element of an object created out of the database, and the ‘path’ is actually a list of numbers (/1/2/3) but this seemed easier to work with.

This stuff used to be simple…. argh, embarrassed šŸ™