I'm trying to wirte a recursive subroutine that recives an array, does some
processing and then calls itself with a new array.
The problem is that I never get to retrive the array after the subroutine
has ran once. When it runs the second time it doesn't get the correct set of
items in the passed in array.
So I'm wondering if I'm calling the subroutine in the wrong way, or if I'm
retriving the parameters incorrectly.
---
&buildBranch(@someNodes);
sub buildBranch()
{
@numNodes = @_;
foreach $item (@numNodes)
{
# if the node is a branch tag, create branch
if ($item->getTagName() eq "branch")
{
# fetch parameters from the XML file
$branchName = $item->getAttribute("name");
$vpath = $item->getAttribute("vpath");
$comment = $item->getAttribute("comment");
$edition = $item->getAttribute("edition");
$owner = $item->getAttribute("owner");
$groupForSharing =
$item->getAttribute("groupForSharing");
&createBranch();
@childBRNodes = $item->getChildNodes();
if (scalar(@childBRNodes) > 0)
{
&buildBranch(@childBRNodes);
}
}
@childNodes = $item->getChildNodes();
if (scalar(@childNodes) > 0)
{
&buildBranch(@childNodes);
}
}
}
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
This email with attachments is solely for the use of the individual or
entity to whom it is addressed. Please also be aware that DnB cannot
accept any payment orders or other legally binding correspondence with
customers as a part of an email.
This email message has been virus checked by the virus programs used
in the DnB Group.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *