In my experience, readdir is almost never what you want. Use glob. Really, it's much easier, and it keeps the full pathname that is fed to it. Your @files array will hold only the filenames, not $path_to_dir. In order for it to be useful, you almost always will need to concatenate $path_to_dir to each item in the array anyway. Since that is probably the case, just use glob and the list you get back will already have the pathname in there, and the values will be useful immediately.
In reply to Re^2: Globbing uncertainty
by Tanktalus
in thread Globbing uncertainty
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |