T
Tore Aursand
Hmm. I'm not quite sure if I got the subject right, but I'll try to
explain.
I've got a hash of elements stored like this:
$VAR1 = {
'element_id' => '8',
'elementtype_id' => '3',
'children' => [],
'parents' => [
{
'position' => '5',
'parent_id' => '3'
},
{
'position' => '3',
'parent_id' => '11'
}
]
};
Records like the one above is stored in a hash (called %hierarchy), with
the 'element_id' as key (yeah, I want that value in the hash itself, too).
The problem: Each element can have more than one parent (as illustrated
above), a parent with a position assigned to it. The element above will
exist two places in the hierarchy, as you might figure.
How should I proceed when I want to sort this hash? I want to sort it by
'parent_id', then 'position'.
Thanks in advance!
--
Tore Aursand <[email protected]>
"You know the world is going crazy when the best rapper is white, the best
golfer is black, France is accusing US of arrogance and Germany doesn't
want to go to war."
explain.
I've got a hash of elements stored like this:
$VAR1 = {
'element_id' => '8',
'elementtype_id' => '3',
'children' => [],
'parents' => [
{
'position' => '5',
'parent_id' => '3'
},
{
'position' => '3',
'parent_id' => '11'
}
]
};
Records like the one above is stored in a hash (called %hierarchy), with
the 'element_id' as key (yeah, I want that value in the hash itself, too).
The problem: Each element can have more than one parent (as illustrated
above), a parent with a position assigned to it. The element above will
exist two places in the hierarchy, as you might figure.
How should I proceed when I want to sort this hash? I want to sort it by
'parent_id', then 'position'.
Thanks in advance!
--
Tore Aursand <[email protected]>
"You know the world is going crazy when the best rapper is white, the best
golfer is black, France is accusing US of arrogance and Germany doesn't
want to go to war."