On Mon, May 14, 2012 at 11:06:59AM +0200, demerphq wrote: [...] > I kinda wish perl had an interface like
> my $iter= iterator(%hash); > while (my ($key,$value)= $iter->each) { } > Which I think would be sane. You could even pass the iterator without > passing the hash itself. (Preventing modifications to the hash but > allowing 3rd party code to iterate it). I suspect it would be relatively simple to write a module to provide that syntax. Without looking, I bet it's already in CPAN.