Dear monastery
In continuation of Proper Way to Reference a Hash Value
Let's say you have a deeply nested data structure, but you want only to display the subtrees where an item (hash key or hash value or array) in between passes a test (eq or regex or whatever)
Data::Printer has filters but they are normally used to format the current item.
I have an idea how to implement it nevertheless, but am quite busy right now. And next week I will certainly forget it.
Extra challenge: print the correct Perl path to access this element.
Anyone interested?
Alternative approaches?
I was asked what "subtree" means. Those nested items which are not predecessor or successor are not displayed.
This would be the subtree for finding the "field" key in the linked thread.
\ { content { errors [ [0] { field "merge_fields", } ], }, }
the path would be ->{content}{errors}[0]{field}
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
In reply to Dump filtered subtree? by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |