|
|
| Perl-Sensitive Sunglasses | |
| PerlMonks |
Re^6: traversing a hash looking for path?by bmann (Priest) |
| on Apr 20, 2006 at 21:43 UTC ( #544713=note: print w/ replies, xml ) | Need Help?? |
|
Hi limbic~region, I would have done it something like this:
Now this quick implementation isn't perfect. It doesn't pretend to find the most efficient path, it finds the first path based on the order of the elements of %net. It is destructive to %net. I don't like the do ... until loop. But I do think it is an elegant solution, IMNSHO ;) Update: This is a depth-first search, not breadth-first as is limbic~region's.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||