That's a nice solution, but is there any particular reason to use an arrayref rather than a scalarref? It'd make the iterating code just a bit cleaner:
while( my $next = $iter->() ) { $next = $$next; ... }
As opposed to:
while( my $next = $iter->() ) { ($next) = @$next; ... }
"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.
In reply to Re^2: Dumb, non-question: How to return 'nothing'.
by hardburn
in thread Dumb, non-question: How to return 'nothing'.
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |