Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

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]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2016-10-21 22:02 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (291 votes). Check out past polls.