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

Re: mkdir in a loop?

by wand3ringscript3r (Initiate)
on Apr 05, 2006 at 14:54 UTC ( [id://541404]=note: print w/replies, xml ) Need Help??


in reply to mkdir in a loop?

I noticed the "?" mark too. Check the "all_control.txt" file to see if it has any extra formatting characters. Then the following should work fine.

#!/usr/bin/perl use strict; my $file = "all_controls.txt"; open(FILE, "<$file") || die "Unable to open $file: $!\n"; my @file_contents = <FILE>; foreach (@file_contents) { chomp; $_ =~ /^(.*?)\..*?$/; # remove filename extension after '.' mkdir ($1, 0755) || die "Unable to create directory: $!\n"; print "Created directory: $1\n" if (! $@); } # end

Edit: g0n - code tags

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-25 19:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found