Hi,
I have this hash which is like a tree.. the hash key is a number and the value is a array of numbers.. these array values are also keys in the same hash.. e.g.
$hash{'1'} = ARR('3', '5', '9');
$hash{'3'} = ARR('2', '7');
$hash{'2'} = ARR();
$hash{'5'} = ARR('10', '11');
and so on...
what I need is a graphical representation so that I can start with "$hash{'1'}" and traverse each branch and print a corresponding output..
I guess I can use a brute force method of using many many for loops, but I'm looking for an easy to understand efficient method to do this.
any help will be appreciated.
---
cheers!
san.
I have this hash which is like a tree.. the hash key is a number and the value is a array of numbers.. these array values are also keys in the same hash.. e.g.
$hash{'1'} = ARR('3', '5', '9');
$hash{'3'} = ARR('2', '7');
$hash{'2'} = ARR();
$hash{'5'} = ARR('10', '11');
and so on...
what I need is a graphical representation so that I can start with "$hash{'1'}" and traverse each branch and print a corresponding output..
Code:
1
|-3
| |- 2
|-5
|- 10
...
I guess I can use a brute force method of using many many for loops, but I'm looking for an easy to understand efficient method to do this.
any help will be appreciated.
---
cheers!
san.