in reply to Use 'ls' to read files in perl????

There is also the forking factor, when ls is used a new process is created with all the overhead. There is also the portability factor, when there is no ls command in the os.

Replies are listed 'Best First'.
Re^2: Use 'ls' to read files in perl????
by JavaFan (Canon) on Jul 08, 2010 at 10:06 UTC
    There is also the forking factor, when ls is used a new process is created with all the overhead.
    Yes, forking a new process totally dwarves going to disk and searching the filesystem.
    There is also the portability factor, when there is no ls command in the os.
    Yeah, but I'd figure the set of OSses that don't come with an 'ls' is about the same set of OSses that don't come with perl. And I wouldn't assume the OP has the intention to take his UNIX centric approach and run it in a non-UNIX environment.