Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Use Mkdir to create dir from list

by rovf (Priest)
on Jun 19, 2012 at 08:31 UTC ( #976982=note: print w/replies, xml ) Need Help??

in reply to Use Mkdir to create dir from list



use File::Path qw(make_path); make_path(map {chomp; $_} <$GSR_fh>);
If you need error handling, have a look at File::Path.

Ronald Fischer <>

Replies are listed 'Best First'.
Re^2: Use Mkdir to create dir from list
by Tux (Abbot) on Jun 20, 2012 at 13:25 UTC

    Huh? chomp does NOT return $_! You will need map { chomp; $_ }

    $ perl -MDP -E'@_=map{$_."\n"}1..5;DDumper[@_]' [ '1 ', '2 ', '3 ', '4 ', '5 ' ] $ perl -MDP -E'@_=map{$_."\n"}1..5;DDumper[map{chomp}@_]' [ 1, 1, 1, 1, 1 ] $ perl -MDP -E'@_=map{$_."\n"}1..5;DDumper[map{chomp;$_}@_]' [ 1, 2, 3, 4, 5 ]

    Enjoy, Have FUN! H.Merijn
      Of course you are right! Silly mistake, thanks for pointing it out. I will update my node.

      Ronald Fischer <>
Re^2: Use Mkdir to create dir from list
by GregorySRobinson (Initiate) on Jun 20, 2012 at 13:10 UTC

    I spent time looking at and testing your solution. As presented and as I interpreted the solution I remains stumped as to how to preform objective. I posted the revised code.Oh, and thank you.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://976982]
[stevieb]: man, I absolutely LOVE driving in the worst winter conditions. In the mountainous roads, there are extremely few (if any) other drivers. I love the challenge. I've been doing extreme off-road my whole life, and as I said, I'm always well...
[stevieb]: ...prepared for even the very worst
Discipulus seems a part of the globe very unfrindly with Kawasaki riders..
[thezip]: My doggies love it when it snows
[perldigious]: As long as you are a good "boy scout" stevieb, more power to you... but I like my Jeep, and don't like the idea of rolling it or crashing it in to anything. :-)
[thezip]: Me, not as much.
[perldigious]: Mine too thezip, especially my German Shepherd. He looks like he is about to die of heat exhaustion all summer, so he goes nuts when winter comes and he can play in the snow.
[stevieb]: my main off-road vehicle nowadays is a strengthened mercedes ML320. I'm very hard on it, but I've never had any real issues at all (I love how small and light it is, and it has a very, very good centre of gravity for how I roll)

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2016-12-06 16:50 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (112 votes). Check out past polls.