Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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

CODE UPDATED (bugfix)

(untested)

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 <ynnor@mm.st>


Comment on Re: Use Mkdir to create dir from list
Download Code
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.

Re^2: Use Mkdir to create dir from list
by Tux (Monsignor) 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 <ynnor@mm.st>

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://976982]
help
Chatterbox?
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: (11)
As of 2014-09-19 14:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (140 votes), past polls