http://www.perlmonks.org?node_id=183337


in reply to Pulling out information for MySQL

If you're storing your information in a MySQL database, why are you using characters to seperate the levels? That's not very good normalization. Instead, I would create each record with a field that references the primary key of its parent. Top-level categories could have 0 as the parent. Then you could select all the records where the parent is zero in order to get your top level categories.