What I can't explain is why the list would be empty if nothing else changed.
A (file)glob evaluates its (embedded) argument only when it is starting
a new list. All values must be read before it will start over.
I think this explains the effect we can see: The first time in the loop, the arguments for glob are evaluated and return one file name. The second time in the loop, the arguments are not evaluated again (since the list is not "exhausted" yet). Instead, glob tries to find the next file, but there is none, and returns undef to signal this fact. On the third iteration, the arguments are evaluated again, yielding one filename.
Ronald Fischer <email@example.com>