Think about Loose Coupling | |
PerlMonks |
Re^3: How might I handle a special tree? (updated)by LanX (Saint) |
on Dec 07, 2014 at 23:02 UTC ( [id://1109502]=note: print w/replies, xml ) | Need Help?? |
> how could I recognize if current element is a scalar or another list to recurse? with ref > What is missing in this structure is theplaceholder, which will have a group name... No idea what you may mean...
updateMaybe [ {A => [1, {B => [2,3,4]} ,5, {C => [ 6, { D => [7,8,9] } ] } ] ? ? ? (untested)
updateTIMTOWTDI Instead of a one element hash you could use a 2 element array. Or put the "placeholder" into the sub array as first element. I personally prefer the hash solution for readability, but keep in mind that keys are stringified.
Cheers Rolf (addicted to the Perl Programming Language and ☆☆☆☆ :)
In Section
Seekers of Perl Wisdom
|
|