http://qs321.pair.com?node_id=147987


in reply to findone { coderef } @array

I expect you have thought of this, but rather than the code key, you could have a function which returned an iterator. This probably makes for uglier calling syntax:
my $next = grepper {$_ == &somethingorother} @array; while (my $found = $next->()) { # ... do something with each match }

but it may be more beautiful underneath. Basically, you create a closure which holds the data and code you need, and a counter which remembers how far along you have got.

dave hj~

PS: oh ok. You're an abbot, you know this...