in reply to treemap

Nice work.

I wrote something of similar structure once for examining values in nested arrays, and found that calling the function again for scalars was very inefficient. You can save a good bit of time by checking for that in the code for each ref type.

I changed the array case like so:

elsif ($type eq 'ARRAY') { $_ = ref() ? _treemap($code, $_, $refs) : &$code() for @$node; }
And verified the same output with fewer instructions.