From nagler at bivio.biz Wed Mar 26 14:53:28 2008 From: nagler at bivio.biz (Rob Nagler) Date: Wed, 26 Mar 2008 15:53:28 -0600 Subject: [Boulder.pm] Weird bug in glob Message-ID: <18410.50648.18548.109945@ski.local> The attached program dies at "bug here" on 5.8. glob() behaves differently depending on whether it is called in a function or not. It appears to be storing state on a per-function basis but not based on the pattern, which makes the code pretty weird to debug. Rob ---------------------------------------------------------------- sub _t { open(OUT, "> " . shift(@_)); close(OUT); } _t('1.rjn'); _t('2.rjn'); my $x = glob('*.rjn'); $x eq '1.rjn' || die; $x = glob('*.rjn'); $x eq '1.rjn' || die; sub _f { return glob('*.rjn'); } $x = _f(); $x eq '1.rjn' || die; $x = _f(); $x eq '1.rjn' || die('bug here');