LPC2010 has asked for the wisdom of the Perl Monks concerning the following question:

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.

Replies are listed 'Best First'.
Re: XML::Simple processing
by GrandFather (Saint) on Dec 22, 2010 at 00:28 UTC

    There is far too much data there for me to be bothered with. How about you generate a small sample script that includes embedded xml data and generates sample output that demonstrates the issue you are having? That has a few advantages:

    1. we don't have to wade through a mass of text to try and understand your problem
    2. you can focus attention on the real issue you are having
    3. you have a simple test bed for trying different techniques
    4. you have a simple way to see is different solutions work
    5. we don't have to whittle your sample data down to something manageable
    6. through seeing your code we can assess your Perl fu and tailor answers and code to suit
    True laziness is hard work
      Thanks for the kick in the butt. I have spent most of my evening on this, and have gotten good results with XML::DOM. It is able to parse my document and pull together the information I need in a recursive loop ...
      sub printNode { my ($theNode) = @_; my $thisType = $theNode->getNodeType; my $nodeList = $theNode->getChildNodes; my $name = $theNode->getNodeName; my $attLength; my $length = $nodeList->getLength; my $attList = $theNode->getAttributes; if( $attList ){ $attLength = $attList->getLength }; #print $sep x ($depth), "-NodeName: '$name' (type $thisType, $leng +th children)\n"; $depth++; for(my $i=0; $i<$length; $i++) { my $node = $nodeList->item($i); my $theType =$node->getNodeType; my $j=$i+1; if ($theType == ELEMENT_NODE ) { #print $sep x ($depth), "[$j]Element Node: '", $node->getT +agName, "'\n"; #Recursive call to itself printNode( $node ); } elsif ($theType == TEXT_NODE ) { my $temp = $node->getData; #Sub out the tabs and newlines with text equivalents $temp =~ s/\n/\\n/g; $temp =~ s/\t/\\t/g; unless ($name eq "provinces") { print $sep x ($depth), $name.qq~="~.$temp.qq~"\n~; } } else { print $sep x ($depth), "[$j]UNKNOWN Node: ", $node->getNod +eName, "\n"; } } $depth--; }
      I get the following output
      path="smallbusiness" en_title="Small Business" fr_title="Petites Entreprises" hideFromMenu="false" hideBreadcrumbs="false" path="products" en_title="Products and Services" fr_title="Produits et Services" hideFromMenu="false" hideBreadcrumbs="false" path="wireless" en_title="Wireless" fr_title="Sans fil" hideFromMenu="false" hideBreadcrumbs="false" path="devices" en_title="Phones and Devices" fr_title="Tlphones et Appareils" portalPageLabel="smb_products_services_wir +eless_devices" hideFromMenu="false" hideBreadcrumbs="false" path="details" en_title="Details" fr_title="Dtails" portalPageLabel="smb_products_services +_wireless_devices_details" hideFromMenu="true" hideBreadcrumbs="true" path="plans" en_title="Plans" fr_title="Forfaits" portalPageLabel="smb_products_services_wir +eless_plans" hideFromMenu="false" hideBreadcrumbs="false"
      The last piece is being able to have the output in XML. the start of each node (i.e. "path" should be prepended with <menuitem and the end of each node (i.e. hideBreadcrumbs should end with ">" *or* "/>". Depending if it has children the XML tag should be left open, if no children, the XML tag should be closed. I can't seem to insert these tags within the recursive logic without having many repeating tags. Thanks a lot for any assistance you might be able to provide.

        Reading between the lines (which you've still not shown) you seem to be translating tags to turn a database represented in XML into a nested menu structure represented in XML. In the absence of the sample code I suggested earlier I've invented a sample and you can either modify it or write your own if my invention doesn't match your need:

        #!/usr/bin/perl use strict; use warnings; use XML::Twig; my $twig = XML::Twig->new( start_tag_handlers => {_all_ => \&convert,}, pretty_print => 'indented_a' ); $twig->parse(*DATA); $twig->print(); sub convert { my ($twig, $elt) = @_; $elt->set_tag('menuitem'); } __DATA__ <lvl_1 path="smallbusiness" en_title="Small Business" fr_title="Petites Entreprises" hideFromMenu="false" hideBreadcrumbs="false" > <lvl_2 path="products" en_title="Products and Services" fr_title="Produits et Service +s" hideFromMenu="false" hideBreadcrumbs="false" /> </lvl_1>

        Prints:

        <menuitem en_title="Small Business" fr_title="Petites Entreprises" hideBreadcrumbs="false" hideFromMenu="false" path="smallbusiness"> <menuitem en_title="Products and Services" fr_title="Produits et Services" hideBreadcrumbs="false" hideFromMenu="false" path="products" /> </menuitem>
        True laziness is hard work
        Thanks for the kick in the butt.

        GrandFather was actually trying to help you - by posting a concise, easily digestable description of the problem, you are much more likely to get the pointers you are looking for.

        I have spent most of my evening on this

        Well, it is your evening - don't expect people to wade through screenfuls of text to try to figure out your problem. See above.

Re: XML::Simple processing
by ww (Archbishop) on Dec 21, 2010 at 23:56 UTC

    Alt 1: Study references some more -- until they cease to confuse you. Tutorials has several entries that should be very helpful and will those threads and nodes four by Super Searching for "reference," "hashref" and similar. If need be, write some simple sample code using refs to deal with small chunks of minimally complex data. See if that helps... and if not, post again. Then, at least, we won't need to read your mind to discover WHAT element(s) of the topic "confuses" you.

    Alt 2: Post that piece of your code that comes closest to doing what you want and the error messages you receive (or a sample of output and a description of how it fails to satisfy your intent.

    Alt 3: Hire a programmer. If understanding references is truly outside your aptitude, you will probably make better use of your time in some other IT field (or other vocation, entirely).

    When posting code or data with unnecessary multi-tab sequences, please replaces the tabs with two, three or four spaces. It makes the data much more readable.