Stuart Woodward Stuart Woodward - 19 days ago 6
Perl Question

Is there still unpredictable behavior with glob() in perl?

I found this piece of wisdom in the PerlFaq quoted in a chat board from 2000.


Is there a leak/bug in glob()?

Due to the current implementation on some operating systems, when you
use the glob() function or its angle-bracket alias in a scalar
context, you may cause a leak and/or unpredictable behavior. It's best
therefore to use glob() only in list context.


I read that this problem was fixed in Perl 5.6 but later heard a report that it still occurs in 5.10.1

Has anyone had any experience of recent problems and where would be the best place to find the definitive answer regarding this?

[Later..] The latest PerlFAQ says:


5.18: Is there a leak/bug in glob()?

(contributed by brian d foy)

Starting with Perl 5.6.0, "glob" is implemented internally rather than
relying on an external resource. As such, memory issues with "glob"
aren't a problem in modern perls.


=====

Finally: The problem that was been reported was due to the misuse of glob by using it in a loop after it had already given all of the matched items. There was no problem with it.

Answer

Use The Source Luke and the Commit History

http://perl5.git.perl.org/perl.git/history/HEAD:/ext/File-Glob

update: While that long obsolete perlfaq5 item was there in 5.14 it is gone in the latest