I have the following output from XMLin

$VAR1 = { 'lvl_1' => { 'lvl_2' => [ { 'fr_title' => 'Produits et Services' +, 'portalPageLabel' => {}, 'path' => 'products', 'provinces' => 'AB, BC, SK, MB, ON, +QC, NS, NB, NL, NU, NT, YT', 'hideFromMenu' => 'false', 'en_title' => 'Products & Servic +es', 'hideBreadcrumbs' => 'false', 'lvl_3' => [ { 'hideFromMenu' => 'fals +e', 'fr_title' => 'Sans fil +', 'lvl_4' => [ { 'hideFromM +enu' => 'false', 'fr_title' + => "T\x{e9}l\x{e9}phones et Appareils", 'en_title' + => 'Phones & Devices', 'portalPag +eLabel' => 'smb_products_services_wireless_devices', 'hideBread +crumbs' => 'false', 'path' => +'devices', 'provinces +' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT', 'lvl_5' => + { + 'hideFromMenu' => 'true', + 'fr_title' => "D\x{e9}tails", + 'en_title' => 'Details', + 'portalPageLabel' => 'smb_products_services_wireless_devices_details +', + 'hideBreadcrumbs' => 'true', + 'path' => 'details', + 'provinces' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT' } }, { 'hideFromM +enu' => 'false', 'fr_title' + => 'Forfaits', 'en_title' + => 'Plans', 'portalPag +eLabel' => 'smb_products_services_wireless_plans', 'hideBread +crumbs' => 'false', 'path' => +'plans', 'provinces +' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT', 'lvl_5' => + { + 'hideFromMenu' => 'true', + 'fr_title' => "D\x{e9}tails", + 'en_title' => 'Details', + 'portalPageLabel' => {}, + 'hideBreadcrumbs' => 'true', + 'path' => 'details', + 'provinces' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT' } }, { 'hideFromM +enu' => 'false', 'fr_title' + => 'Applications fil', 'en_title' + => 'Apps', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'apps', 'provinces +' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT', 'lvl_5' => + [ + { + 'hideFromMenu' => 'false', + 'fr_title' => 'FR::Productivity Apps', + 'en_title' => 'Productivity Apps', + 'portalPageLabel' => {}, + 'hideBreadcrumbs' => 'false', + 'path' => 'productivityapps', + 'provinces' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT' + }, + { + 'hideFromMenu' => 'false', + 'fr_title' => 'FR::Communication and Information Apps', + 'en_title' => 'Communication and Information Apps', + 'portalPageLabel' => {}, + 'hideBreadcrumbs' => 'false', + 'path' => 'communicationandinformationapps', + 'provinces' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT' + }, + { + 'hideFromMenu' => 'false', + 'fr_title' => 'FR::Location Apps', + 'en_title' => 'Location Apps', + 'portalPageLabel' => {}, + 'hideBreadcrumbs' => 'false', + 'path' => 'locationapps', + 'provinces' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT' + } ] }, { 'hideFromM +enu' => 'false', 'fr_title' + => 'FR::Add Ons', 'en_title' + => 'Add Ons', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'addons', 'provinces +' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT', 'lvl_5' => + [ + { + 'hideFromMenu' => 'false', + 'fr_title' => 'FR::travel', + 'en_title' => 'Travel', + 'portalPageLabel' => {}, + 'hideBreadcrumbs' => 'false', + 'path' => 'travel', + 'provinces' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT' + }, + { + 'hideFromMenu' => 'false', + 'fr_title' => 'FR::Data', + 'en_title' => 'Data', + 'portalPageLabel' => {}, + 'hideBreadcrumbs' => 'false', + 'path' => 'data', + 'provinces' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT' + }, + { + 'hideFromMenu' => 'false', + 'fr_title' => 'FR::Value Packs', + 'en_title' => 'Value Packs', + 'portalPageLabel' => {}, + 'hideBreadcrumbs' => 'false', + 'path' => 'valuepacks', + 'provinces' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT' + } ] }, { 'hideFromM +enu' => 'false', 'fr_title' + => 'FR::Mobile Internet', 'en_title' + => 'Mobile Internet', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'mobileinternet', 'provinces +' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT', 'lvl_5' => + { + 'fr_title' => 'FR::Hardware', + 'portalPageLabel' => {}, + 'path' => 'hardware', + 'provinces' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT', + 'hideFromMenu' => 'false', + 'lvl_6' => { + 'hideFromMenu' => 'true', + 'fr_title' => "D\x{e9}tails", + 'en_title' => 'Details', + 'portalPageLabel' => {}, + 'hideBreadcrumbs' => 'true', + 'path' => 'details', + 'provinces' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, N +T, YT' + }, + 'en_title' => 'Hardware', + 'hideBreadcrumbs' => 'false' } }, { 'hideFromM +enu' => 'false', 'fr_title' + => 'Accessoires', 'en_title' + => 'Accessories', 'portalPag +eLabel' => 'smb_products_services_wireless_accessories', 'hideBread +crumbs' => 'false', 'path' => +'accessories', 'provinces +' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT' }, { 'hideFromM +enu' => 'false', 'fr_title' + => "Couverture du r\x{e9}seau", 'en_title' + => 'Network Coverage', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'coverage', 'provinces +' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT' }, { 'hideFromM +enu' => 'false', 'fr_title' + => "Calculateur de donn\x{e9}es", 'en_title' + => 'Data Calculator', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'datacalculator', 'provinces +' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT' }, { 'hideFromM +enu' => 'false', 'fr_title' + => "Sans fil \x{e9}volu\x{e9}", 'en_title' + => 'Advanced Wireless', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'advanced', 'provinces +' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT' } ], 'en_title' => 'Wireless +', 'portalPageLabel' => {} +, 'hideBreadcrumbs' => 'f +alse', 'path' => 'wireless', 'provinces' => 'AB, BC, + SK, MB, ON, QC, NS, NB, NL, NU, NT, YT' }, { 'hideFromMenu' => 'fals +e', 'fr_title' => 'Internet + d\'affaires', 'lvl_4' => [ { 'hideFromM +enu' => 'false', 'fr_title' + => 'Forfaits', 'en_title' + => 'Packages', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'packages', 'provinces +' => 'ON, NB, NL' }, { 'hideFromM +enu' => 'false', 'fr_title' + => "\x{c9}quipement", 'en_title' + => 'Hardware', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'hardware', 'provinces +' => 'AB, ON, NB, NL' }, { 'hideFromM +enu' => 'false', 'fr_title' + => "Sauvegarde de donn\x{e9}es", 'en_title' + => 'Data Backup', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'databackup', 'provinces +' => 'QC, NB, NL' }, { 'hideFromM +enu' => 'false', 'fr_title' + => 'Protection en ligne', 'en_title' + => 'Protection Suite', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'protection', 'provinces +' => 'QC, NB, NL' }, { 'hideFromM +enu' => 'false', 'fr_title' + => 'Internet sans fil', 'en_title' + => 'Mobile Internet', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'mobileinternet', 'provinces +' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT', 'lvl_5' => + { + 'fr_title' => "\x{c9}quipement", + 'portalPageLabel' => {}, + 'path' => 'hardware', + 'provinces' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, NT, YT', + 'hideFromMenu' => 'false', + 'lvl_6' => { + 'hideFromMenu' => 'true', + 'fr_title' => "D\x{e9}tails", + 'en_title' => 'Details', + 'portalPageLabel' => {}, + 'hideBreadcrumbs' => 'true', + 'path' => 'details', + 'provinces' => 'AB, BC, SK, MB, ON, QC, NS, NB, NL, NU, N +T, YT' + }, + 'en_title' => 'Hardware', + 'hideBreadcrumbs' => 'false' } }, { 'hideFromM +enu' => 'false', 'fr_title' + => 'FR::Web Hosting', 'en_title' + => 'Web Hosting', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'webhosting', 'provinces +' => 'AB, ON, NB, NL' }, { 'hideFromM +enu' => 'false', 'fr_title' + => 'FR::Data Fax', 'en_title' + => 'Data Fax', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'internetfax', 'provinces +' => 'QC, NB, NL' } ], 'en_title' => 'Business + Internet', 'portalPageLabel' => {} +, 'hideBreadcrumbs' => 'f +alse', 'path' => 'internet', 'provinces' => 'AB, BC, + SK, MB, ON, QC, NS, NB, NL, NU, NT, YT' }, { 'hideFromMenu' => 'fals +e', 'fr_title' => "T\x{e9}l +\x{e9} d'affaires", 'lvl_4' => [ { 'hideFromM +enu' => 'false', 'fr_title' + => 'FR::Overview', 'en_title' + => 'Overview', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'overview', 'provinces +' => 'QC, NB, NL' }, { 'hideFromM +enu' => 'false', 'fr_title' + => "Cha\x{ee}nes", 'en_title' + => 'Channels', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'channels', 'provinces +' => 'ON, NB, NL' }, { 'hideFromM +enu' => 'false', 'fr_title' + => "\x{c9}quipement", 'en_title' + => 'Hardware', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'hardware', 'provinces +' => 'ON, NB, NL' }, { 'hideFromM +enu' => 'false', 'fr_title' + => 'Sur demande', 'en_title' + => 'On Demand', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'ondemand', 'provinces +' => 'ON, NB, NL' }, { 'hideFromM +enu' => 'false', 'fr_title' + => "\x{c0} la carte", 'en_title' + => 'Pay Per View', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'payperview', 'provinces +' => 'ON, NB, NL' }, { 'hideFromM +enu' => 'false', 'fr_title' + => 'FR::Theme packs', 'en_title' + => 'Theme packs', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'themepacks', 'provinces +' => 'ON, NB, NL' } ], 'en_title' => 'Business + Cable TV', 'portalPageLabel' => {} +, 'hideBreadcrumbs' => 'f +alse', 'path' => 'tv', 'provinces' => 'ON, NB, + NL' }, { 'hideFromMenu' => 'fals +e', 'fr_title' => "T\x{e9}l +\x{e9}phone d'affaires", 'lvl_4' => [ { 'hideFromM +enu' => 'false', 'fr_title' + => 'Forfaits', 'en_title' + => 'Packages', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'packages', 'provinces +' => 'ON, NB, NL' }, { 'hideFromM +enu' => 'false', 'fr_title' + => 'Fonctions d\'appel', 'en_title' + => 'Calling Features', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'features', 'provinces +' => 'ON, NB, NL' }, { 'hideFromM +enu' => 'false', 'fr_title' + => "Conf\x{e9}rence", 'en_title' + => 'Conferencing', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'conferencing', 'provinces +' => 'ON, NB, NL' }, { 'hideFromM +enu' => 'false', 'fr_title' + => "Num\x{e9}ros sans frais", 'en_title' + => 'Toll Free', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'tollfree', 'provinces +' => 'ON, NB, NL' }, { 'hideFromM +enu' => 'false', 'fr_title' + => 'Appels interurbains', 'en_title' + => 'Long Distance', 'portalPag +eLabel' => {}, 'hideBread +crumbs' => 'false', 'path' => +'longdistance', 'provinces +' => 'ON, NB, NL' } ], 'en_title' => 'Business + Phone', 'portalPageLabel' => {} +, 'hideBreadcrumbs' => 'f +alse', 'path' => 'businessphon +e', 'provinces' => 'ON, NB, + NL' } ] }, { 'fr_title' => 'Rogers', 'portalPageLabel' => {}, 'path' => 'rogers', 'provinces' => 'AB, BC, SK, MB, ON, +QC, NS, NB, NL, NT, YT', 'hideFromMenu' => 'false', 'en_title' => 'Rogers for Business', 'hideBreadcrumbs' => 'false', 'lvl_3' => [ { 'hideFromMenu' => 'fals +e', 'fr_title' => 'FR::Hand +set Protection', 'en_title' => 'Handset +Protection', 'portalPageLabel' => {} +, 'hideBreadcrumbs' => 'f +alse', 'path' => 'handsetprote +ction', 'provinces' => 'AB' }, { 'hideFromMenu' => 'fals +e', 'fr_title' => 'FR::Live + Agent', 'en_title' => 'Live Age +nt', 'portalPageLabel' => {} +, 'hideBreadcrumbs' => 'f +alse', 'path' => 'liveagent', 'provinces' => 'AB' }, { 'hideFromMenu' => 'fals +e', 'fr_title' => 'FR::Cove +rage', 'en_title' => 'Coverage +', 'portalPageLabel' => {} +, 'hideBreadcrumbs' => 'f +alse', 'path' => 'coverage', 'provinces' => 'AB' } ] }, { 'hideFromMenu' => 'false', 'fr_title' => 'FR::solutions', 'en_title' => 'Solutions', 'portalPageLabel' => {}, 'hideBreadcrumbs' => 'false', 'path' => 'solutions', 'provinces' => 'AB, BC, SK, MB, ON, +QC, NS, NB, NL, NU, NT, YT' }, { 'fr_title' => 'Promotions', 'portalPageLabel' => {}, 'path' => 'promotions', 'provinces' => 'AB, BC, SK, MB, ON, +QC, NS, NB, NL, NU, NT, YT', 'hideFromMenu' => 'false', 'en_title' => 'Promotions', 'hideBreadcrumbs' => 'false', 'lvl_3' => [ { 'hideFromMenu' => 'fals +e', 'fr_title' => 'FR::IFP' +, 'en_title' => 'IFP', 'portalPageLabel' => {} +, 'hideBreadcrumbs' => 'f +alse', 'path' => 'ifp', 'provinces' => 'AB, BC, + SK, MB, ON, QC, NS, NB, NL, NU, NT, YT' }, { 'hideFromMenu' => 'fals +e', 'fr_title' => 'FR::OFP' +, 'en_title' => 'OFP', 'portalPageLabel' => {} +, 'hideBreadcrumbs' => 'f +alse', 'path' => 'ofp', 'provinces' => 'AB, BC, + SK, MB, ON, QC, NS, NB, NL, NU, NT, YT' } ] }, { 'hideFromMenu' => 'false', 'fr_title' => 'FR::Resource Center', 'en_title' => 'Resource Center', 'portalPageLabel' => {}, 'hideBreadcrumbs' => 'false', 'path' => 'resourcecenter', 'provinces' => 'AB, BC, SK, MB, ON, +QC, NS, NB, NL, NU, NT, YT' }, { 'hideFromMenu' => 'false', 'fr_title' => 'Soutien', 'en_title' => 'Support', 'portalPageLabel' => {}, 'hideBreadcrumbs' => 'false', 'path' => 'support', 'provinces' => 'AB, BC, SK, MB, ON, +QC, NS, NB, NL, NU, NT, YT' }, { 'hideFromMenu' => 'false', 'fr_title' => 'Contactez-nous', 'en_title' => 'Contact Us', 'portalPageLabel' => 'smb_contactUs' +, 'hideBreadcrumbs' => 'false', 'path' => 'contactus', 'provinces' => 'AB, BC, SK, MB, ON, +QC, NS, NB, NL, NU, NT, YT' } ], 'fr_title' => 'Petites Entreprises', 'portalPageLabel' => {}, 'path' => 'smallbusiness', 'provinces' => 'AB, BC, SK, MB, ON, QC, NS, NB, N +L, NU, NT, YT', 'hideFromMenu' => 'false', 'en_title' => 'Small Business', 'hideBreadcrumbs' => 'false' }, 'btnUpdateNav' => {} };

I would like to show the nested relationship among the different levels so I produce another XML document. However, I get confused when I run into hash references and array references, I have tried many tests, but don't seem to get any results :-( I am not looking for free code, just some guidance on the best way to loop through this data structure. Thank you.

In reply to XML::Simple processing by LPC2010

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.