in reply to
Re^3: Using grep and glob to find directories containing file
in thread Using grep and glob to find directories containing file
Thanks for the help and explanation!!!
This behavior is certainly not obvious and it is not (clearly) documented either under 'perldoc -f glob' or at perldoc.perl.org.
The line saying "In scalar context, glob iterates through such filename expansions, returning undef when the list is
exhausted" does not make it clear (at least to me) that such a state persists across calls to glob with a new argument! In fact, I can imagine all types of unintended errors when glob has been called in a scalar context in one place and then many lines later is called again in a different context and the programmer would have no idea that the state persists.
But then again I am not a Perl monk so these things are never obvious to me :)