this is the best way i dont want or wish to remember regular expresions for something that should be easy to do, i will use this to create a function like list($dir,"f"); for files "d" for directory, thanks for posting this
–
GeomorilloMar 3 '14 at 6:41

This will list Everything (including sub directories) from the directory you specify, in order, and with the attributes. I have spent days looking for something to do this, and I took parts from this entire discussion, and a little of my own, and put it together. ENJOY!!

If you are a slacker like me you might like to use the File::Slurp module. The read_dir function will reads directory contents into an array, removes the dots, and if needed prefix the files returned with the dir for absolute paths