in reply to Re: while loop break when sub call
in thread while loop break when sub call

Your comment pointed my mistake. In the subroutine, I create a new group, that must be the source of the problem.

Using an intermediate array solved the problem. One of those cause that is so evident that you don't see it

Replies are listed 'Best First'.
Re^3: while loop break when sub call
by locked_user sundialsvc4 (Abbot) on Jan 09, 2015 at 22:39 UTC

    Yes, undoubtedly the creation of a new group broke the iterator.   That sort of thing happens a lot, and it goes back to the underlying operating system primitives.   For example, I’ve found that when iterating through files and directories in Microsoft Windows (regardless of language), you mustn’t create/remove files or directories while doing so.   First complete the scan (e.g. of one complete subdirectory), then act upon/iterate through an in-memory list of the things that the scan finds, and all is well.