Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Use Mkdir to create dir from list

by rovf (Priest)
on Jun 19, 2012 at 08:31 UTC ( [id://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>

Replies are listed 'Best First'.
Re^2: Use Mkdir to create dir from list
by Tux (Canon) 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>
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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://976982]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-20 04:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found