Re: multidimensional insertion order
- From: Spin <cNaOlSePbA@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 28 Jul 2005 13:54:26 -0600
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;
}
etcThe 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 .
- Follow-Ups:
- Re: multidimensional insertion order
- From: Fabian Pilkowski
- Re: multidimensional insertion order
- From: Abigail
- Re: multidimensional insertion order
- From: Paul Lalli
- Re: multidimensional insertion order
- References:
- multidimensional insertion order
- From: Spin
- Re: multidimensional insertion order
- From: Abigail
- Re: multidimensional insertion order
- From: Spin
- Re: multidimensional insertion order
- From: Paul Lalli
- Re: multidimensional insertion order
- From: Spin
- Re: multidimensional insertion order
- From: Paul Lalli
- multidimensional insertion order
- Prev by Date: Re: How to take acton upon a pattern of nth occurrence?
- Next by Date: Re: length of an array in a struct in an array of structs in a struct in an array of structs
- Previous by thread: Re: multidimensional insertion order
- Next by thread: Re: multidimensional insertion order
- Index(es):
Relevant Pages
|
|