in reply to Dumb, non-question: How to return 'nothing'.
I'd say, if your iterating can return anything, including whatever you intent to signal "end of input", you should probably not use a closure. Use an object, and write something like:
while (!$iter->end_of_data) { my $next = $iter->next; ... }
|
|---|