I've got this XML file that I'm trying to parse to take out some values to put into a CSV file. One part of the file is some "tax_lines" that are associated with some invoices. I need to take out the tax_lines so that I can put them with the invoice lines in the CSV. To do this I have decided to use a Hash->Hash->Array data structure. With the first key being the sequence, the second key being the sub_sequence numbers and the array containing the information. Here is what I have so far:
I think I can put the information into the Hash fine, but I can't reference it at the end.
Any ideas?
Code:
my %taxlines;
foreach my $taxline ($transaction->getElementsByTagName("tax_line")) {
my $tax_type = $taxline->getAttributeNode("tx_tax_type")->getValue;
my $tax_sequence = $taxline->getAttributeNode("tx_sequence")->getValue;
my $tax_sub_sequence = $taxline->getAttributeNode("tx_sub_sequence")->getValue;
my $tax_code = $taxline->getAttributeNode("tx_tax_code")->getValue;
my $tax_goods_value = $taxline->getAttributeNode("tx_goods_value")->getValue;
my $tax_value = $taxline->getAttributeNode("tx_tax_value")->getValue;
my @tax_array = [$tax_code, $tax_goods_value, $tax_value];
$taxlines{$tax_sequence}{$tax_sub_sequence} = [@tax_array];
}
print $taxlines{1}{1}[2];
I think I can put the information into the Hash fine, but I can't reference it at the end.
Any ideas?