in reply to Re: glob behavior
in thread glob behavior
What I can't explain is why the list would be empty if nothing else changed.From perlop:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: glob behavior
by vagabonding electron (Curate) on Mar 20, 2012 at 08:56 UTC |