On Sun, Jun 15, 2003 at 09:35:38PM +0200, Marcin Kasperski wrote: > > > Does there exist some way to protect before this problem (some kind of > > > auto-destructor, finally, whatever which would automatically rewind > > > the hash internal iterator while leaving the context)? > > > > Not really a mod_perl problem, but you can read about the solution in > > the docs for each. > > > > There is a single iterator for each hash, shared by all "each", > > "keys", and "values" function calls in the program; it can be reset > > by reading all the elements from the hash, or by evaluating "keys > > HASH" or "values HASH". > > I found this note before asking, believe me... > But it seems to me that this solution is not satisfactory - calling > 'keys' or 'values' is inefficient and destroys most gains from > iterating over the hash using each...
Calling keys() (or values()) in void context is quite efficient. Whether or not you appreciate the aesthetics is perhaps quite another matter. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net