in reply to Re^2: Read a list of files into an array
in thread Read a list of files into an array

Funny how you and Argel are slicing the Camel's hair over glob and file systems :-)

I would say, for portablitiy "get out of the bad habit of using glob" to get a list of files, since glob - what do the docs say?

In list context, returns a (possibly empty) list of filename expansions on the value of EXPR such as the standard Unix shell /bin/csh would do. In scalar context, glob iterates through such filename expansions, returning undef when the list is exhausted.

There. That dratted csh - glob clearly has a UNIX bias. To know what glob really does, you have to know how the filename expansion of csh works - it uses the shell's wildcard syntax to filter filenames, not perl regular expressions. That's enough reason for me to almost never use glob.

So - for sake of portability use opendir and readdir.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
  • Comment on Re^3: Read a list of files into an array