I have a list of filenames, and for each one I want to create a directory with that filename. However, I keep getting directories with '?' on the end that don't actually seem to exist. Can anyone advise? Thanks!
open (FILE, "all_controls.txt") or die "can't open file $!"; my @file=; foreach my $file (@file) { mkdir "$file"; }
chomp(my @file =);
open (FILE, "all_controls.txt") or die "can't open file $!"; my @file=; chomp @file; foreach my $file (@file) { mkdir "$file"; }
Regards,
Murugesan Kandasamy
use perl for(;;);
Check "all_control.txt" for any extra formatting characters. #!/usr/bin/perl use strict; my $file = "all_controls.txt"; open(FILE, "<$file") || die "Unable to open $file: $!\n"; my @file_contents =; foreach (@file_contents) { chomp; $_ =~ /^(.*?)\..*?$/; # remove filename extension mkdir ($1, 0755) || die "Unable to create directory: $!\n"; print "Created directory: $1\n" if (! $@); } # end
perlmonks.org content © perlmonks.org and ambrus, Anonymous Monk, murugu, wand3ringscript3r
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03