Re: multidimensional insertion order



Alright, let's try again.

I'm parsing a quasi-xml file into a hash, and here is the code that is relevant:

# keep hashes in order of entry
tie %xml_lines, "Tie::IxHash";

# Open XML file
open (XML, "/samples/radiology2") || die("Can't open XML File: $!.");

$section_number = 1;
# Read XML file into a hash
while (<XML>) {
	trim($_);
	if (/^<(.+?)>(.+?)<\/\1>$/) {
		$contents = trim($2);
		$contents =~ s/\|/<br>/g;
		$contents =~ s/<br> /<br>/g;
		$contents =~ s/ <br>/<br>/g;
		tie $xml_lines{$section}->{$section_number}, "Tie::IxHash";
		$xml_lines{$section}->{$section_number}->{$code_name} = $contents;
}
etc

The first tie (tie %xml_lines, "Tie::IxHash";) maintains insertion order at the {$section_number} level.

The second tie (in the if statement) is where I get the error "Can't locate object method "TIESCALAR" via package "Tie::IxHash" at wis_xml_to_html.pl line 56, <XML> line 2."

How do I use Tie::IxHash to maintain the order of insertion in my while loop at the {$code_name} level?

Apologies to the offended,
Caleb
.



Relevant Pages

  • RE: Problem with LWP::UserAgent
    ... have an xml file that contains a list of URLs. ... hash and pass them as a parameter into the function that does LWP get. ... > assume your script is named net.pl, you can involve the debugger with: ...
    (perl.beginners)
  • Re: XML Parsing too slow with XML::Simple
    ... >>> have eliminated the database as the time hog in this equation. ... Your xml file may be 18Mb, but it only has one level ... data in the hash after it is built is going to take a protracted amount of ... configuration files you want to get quickly into a hash. ...
    (comp.lang.perl.misc)
  • Re: PREfast (5744) fails some WDF headers, and thus my code too
    ... When and if they get it fixed the txt has a hash that will link ... it to the driver, but for now hand massage the xml file. ... Why is this little tidbit not included in the DTM documentation? ...
    (microsoft.public.development.device.drivers)
  • Re: Now that SHA-1 is cracked...
    ... > to hash to the same value. ... However and unfortunately, some applications use ... SHA-1 as a more basic building block of their security. ... matches the hash in the xml file. ...
    (microsoft.public.exchange2000.connectivity)
  • Re: Now that SHA-1 is cracked...
    ... > to hash to the same value. ... However and unfortunately, some applications use ... SHA-1 as a more basic building block of their security. ... matches the hash in the xml file. ...
    (microsoft.public.inetserver.iis)