I have a list of files that I want to ensure are actually files (the user will be feeding in filenames via a configuration file and I don't want the program to go further if said file(s) don't exist). I'm using glob in case the absolute path names contain a space character somewhere.
The thing that's bothering me about this is "Why does glob give me a valid answer for the first item in my list, even when I'm using it in scalar context, and not the second?" Is it set in stone somehow, like m/$abc/o is set to only optimize the first interpretation you ask of it? Because in my example, when I use a different instance of glob (i.e. the second foreach loop/block) against the "second" filename, it kicks it out just fine (and then fails on the "previously okay" first value). In DWIM-land, I'd think that each invocation of glob, even within a foreach loop, would be independent of the last.
Though as I said before, I can move ahead with answers that work, and the slice/[0] suggestion works. :-)
In reply to Re^2: Using File::DosGlob::glob in loop only works first time
by ff
in thread Using File::DosGlob::glob in loop only works first time
by ff
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |