Re: multidimensional insertion order
- From: Fabian Pilkowski <pilkowsk@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 28 Jul 2005 23:55:22 +0200
* Spin schrieb:
>
> Alright, let's try again.
> I'm parsing a quasi-xml file into a hash, and here is the code that is
> relevant:
[...]
> tie $xml_lines{$section}->{$section_number}, "Tie::IxHash";
Your $xml_lines{$section}->{$section_number} is just a reference to the
hash. You know about this due to your next line of code:
> $xml_lines{$section}->{$section_number}->{$code_name} = $contents;
You're using Perl's dereferencing operator "->" to access a value of
that reference.
>
> 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?
Since you don't want to tie a reference [1], you have to tie a hash
instead. Try to dereference the whole hash with "%{}" first:
tie %{ $xml_lines{$section}->{$section_number} }, "Tie::IxHash";
regards,
fabian
[1] A reference is actually stored in a scalar. Thus you get an error
message about "TIESCALAR" (you're trying to tie a scalar and Tie::IxHash
can't do that because it has no mothod named "TIESCALAR"). That's all.
.
- Follow-Ups:
- Re: multidimensional insertion order
- From: Spin
- 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
- Re: multidimensional insertion order
- From: Spin
- multidimensional insertion order
- Prev by Date: Re: Perl DBI - How to handle large resultsets?
- Next by Date: FAQ 4.6 Why doesn't & work the way I want it to?
- Previous by thread: Re: multidimensional insertion order
- Next by thread: Re: multidimensional insertion order
- Index(es):
Relevant Pages
|
|