"I'll just mark my position with caller and if each() isn't called from the same spot, automatically reset the index."
Not addressing the question directly - but I'd not like this behaviour even if you could do it. Consider the case when you go back to the same location without having accessed the hash in between. Would it really make sense for it to carry on from the same position?
Personally I'd abstract out a separate iterator so you would do something like:
my $array = Array::AsHash->new({array => \@array}); { my $next_key_value = $array->each; while ( my ($key, $value) = $next_key_value->() ) { print "$key : $value\n"; last if some_condition($key, $value); } }
In reply to Re: Caller, caller, wherefore art thou, caller?
by adrianh
in thread Caller, caller, wherefore art thou, caller?
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |