【发布时间】:2014-10-25 09:40:28
【问题描述】:
我有一个数组说
my @array = (1,4,5,8);
上述数组的每个元素可能有也可能没有子元素。
假设 1 有 2,3 作为孩子,5 有 10 作为孩子。
我必须操作数组使其变为1,2,3,4,5,10,8
我现在在做什么
foreach (@$children_indexes){ #myarray
foreach ($self->{RELATION}[$_]->{CHILDREN}){ #find the child of each index
push @$children_indexes, @$_; #I need to change this, as this is pushing at the end
}
}
【问题讨论】: