CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [ravi.joshi53] Reading all the files from a directory: Edit Log



Zhris
Enthusiast

Sep 11, 2012, 1:49 PM


Views: 1263
Re: [ravi.joshi53] Reading all the files from a directory

Hi ravi,

I had updated my code since you read, which I guess makes things more complicated with use of map too.

I am using grep to ensure elements readdir returns that are not files (namely directories) are removed. Grep is fundamentally a list filter operation. If you are concerned, the map is used to translate the file_name into a full file_path rather than doing it inside the loop.

I tested the code on Windows and the / file separator works fine (see the actual $dir_path I tested with below). I've actually never considered this issue before now (i'll look into it!).


Code
my $dir_path = 'C:/Users/Chris/Desktop/Perl bits bobs';


Thanks,

Chris


(This post was edited by Zhris on Sep 11, 2012, 1:52 PM)


Edit Log:
Post edited by Zhris (Enthusiast) on Sep 11, 2012, 1:50 PM
Post edited by Zhris (Enthusiast) on Sep 11, 2012, 1:51 PM
Post edited by Zhris (Enthusiast) on Sep 11, 2012, 1:52 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives