http://qs321.pair.com?node_id=1187644


in reply to Strange behaviour when using glob in if condition

Is it just a difference between scalar and list context? See the glob help: In list context (like my @files = glob(...)), you get a list of filenames, or the empty list if nothing matches. In scalar context, you get an iterator. When you evaluate the iterator, it yields the next matching filename, or undef when it reaches the end. Since your code works correctly when glob is in list context, maybe some of the glob calls in scalar context actually share an iterator?