pimperator has asked for the wisdom of the Perl Monks concerning the following question:
opendir(DIR, $top.$second) or die "CANNOT OPEN SECOND DIRECTORY\n" +; @nameFolders = grep { !/^\.|\.\.$/ } readdir(DIR); closedir(DIR); foreach(@nameFolders){ $folder = $_; if($_ =~ /\.txt$/){ next; } #sometimes .txt files are here + but I took care of them earlier in the code and that works just fine #print $_."\n"; #Output is 100% perfect here opendir FIL, $top.$second."/".$folder or die "CANNOT OPEN +NAME DIRECTORY\n"; @files = grep { /\.txt$/ } readdir(FIL); closedir(FIL); foreach(@files){ $fileName = $_; print $fileName."\n"; #HERE IS MY PROBLEM OUTPUT IS BE +LOW @fileName = split / /, $fileName; $numID = $fileName[0]; $goodFiles{$fileName}=$numID; } }
What is going on here? I'm not spiting the file name until after I print, AND it's in the @files array. I'm at a loss. Thanks for any input.OUTPUT: 1234 ACS. (STUFF).txt ACS. 1235 ACS. (STUFF).txt ACS. ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unwanted splitting of File Name
by choroba (Cardinal) on May 23, 2014 at 07:14 UTC | |
|
Re: Unwanted splitting of File Name
by Anonymous Monk on May 23, 2014 at 07:13 UTC | |
by jellisii2 (Hermit) on May 23, 2014 at 11:57 UTC | |
|
Re: Unwanted splitting of File Name
by AnomalousMonk (Archbishop) on May 23, 2014 at 14:22 UTC |