in reply to Re^2: foreach to for
in thread foreach to for

Unfortunately, the story is about as clear as mud.

Agreed. The important point for OP is that it is not clear when or if Perl ever calculates the number of items. In many cases Perl simply doesn't know or care. For OP's purposes when, how or if Perl ever evaluates the number of items is actually irrelevant, but OP hasn't figured that out yet. C++ is a whole different world, but the STL does provide similarly anonymous management of lists.


DWIM is Perl's answer to Gödel