in reply to An iterator for (not "iterating") a recursive data structure.
"...AoA[oA[oA]...]]...iterate over the leaves...quit the iteration at an arbitrary point"
Perhaps Data::Rmap does the job?
use strict; use warnings; use Data::Rmap qw(rmap); my @data = [ [0], 1, 2, [ 3, 4, 5 ], 6, [ 7, 8, [ 9, 10 ], [ 11, [12] +, 13 ], ], 14 ]; my $something = 5; eval { rmap { $_ <= $something ? print : die; } @data; }; __END__ monks>rmap.pl 0 1 2 3 4 5
Edit: Forgot to copy&paste something ;-) ...and fixed some entities
Best regards, Karl
«The Crux of the Biscuit is the Apostrophe»
|
|---|