I get some strange behaviour searching for files using glob
.
(I think its intended, but I don't want it in my case)
I have 2 files named aaa:bbb
and aaa:ccc
.
I have code to see if files with prefix aaa:*
exists. I do this with this code:
my $filelocation_special = "aaa";
if (glob($filelocation_special . ":*")) {
# file(s) exists!
}
This works. However, if I run the same code again two more times glob returns undefined.
these are my returns: (most of the time anyway)
print STDERR "glob: " . glob($filelocation_special . ":*") . "\n";
# 1 run: aaa:bbb
# 2 run: aaa:ccc
# 3 run:
What can I do to reset glob
to always just check if files with this prefix exists?
Maybe I should use some different check altogether, but I can't seem to find anything that is fast and just checks if the files exists.