In scalar context (your second example), glob will iterate over the items that match -- one item per call, and return undef if no more items remain. In list context (your first example), glob will return the entire list of items that matched, and that list could possibly be empty.
So your two examples do differ in the context in which glob is being called, and that is documented to provide different behavior. Essentially, in scalar context glob acts like an iterator. In list context it doesn't iterate; it just returns a list.
What I can't explain is why the list would be empty if nothing else changed.
Dave
In reply to Re: glob behavior
by davido
in thread glob behavior
by vagabonding electron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |