I've stumbled across the following code:
It seems unelegant and unrobust to me, so I investigated a little bit further. To my surprise I found a strange behaviour of glob, when a glob is given that does not match but that does not contain wildcards also. Given the folowing examples:my $mask = shift; my @folders = glob("$mask"); if (scalar(@folders) == 0) { return undef; }
assume you have the files file1 and file2 in the directory glob is searching, the returns are 'file1' for @t1, '1' for @t2, 'file2' for @t3 and the empty list for @t4.@t1 = glob('*1'); @t2 = glob('1'); @t3 = glob('file2'); @t4 = glob('*3');
The behaviour for @t2 is what seems odd/annoying. In my opinion it should be empty, as the current semantics make it indistinguishable from the @t3 case - which is correct imho.
Please tell me, that I've found a bug that is soon to be fixed... :-}
Bye
PetaMem
In reply to Isn't glob annoying? (somehow) by PetaMem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |