in reply to Re: Using File::DosGlob::glob in loop only works first time
in thread Using File::DosGlob::glob in loop only works first time
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. :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Using File::DosGlob::glob in loop only works first time
by ikegami (Patriarch) on Feb 24, 2006 at 21:46 UTC | |
by ff (Hermit) on Feb 24, 2006 at 22:21 UTC | |
by ikegami (Patriarch) on Feb 25, 2006 at 06:30 UTC | |
by ff (Hermit) on Feb 25, 2006 at 22:59 UTC | |
by ikegami (Patriarch) on Feb 26, 2006 at 00:12 UTC |