If all you want is to get a list of files in a directory so you can process them, you don't need to redirect the output to a file. Here's an example that gets the list of files into an array.
Why start an exra process? perl has plenty of file and directory handling features built in.
You'll note that I used a forward slash rather than a pair of backslashes. Windows can use either. If you always use forwardslahes, your code is easier to read, you'll never forget to backslash-escape a backslash and, who knows, it might run on *ix boxes as well. I did it 'cos I'm lazy.
f
"As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs."
--Maurice Wilkes
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.