eide has asked for the wisdom of the Perl Monks concerning the following question:
The problem is it only writes out with the first file it comes to. I originally had the program writing out to the csv files line by line inside the code and everything worked fine, then I made some necessary code changes to incorporate the %parents hash and now it still creates the other csv files but they are all 0 bytes. No matter what combination of files there are in the directory it only writes data to the first one. Any ideas? Thanks in advance.. . opendir D, $opts{d} or die ...; . . foreach my $file (readdir D) { my ($filebase, $dirname, $ext) = fileparse($file, '\..*'); my $csvFile = "$opts{d}\\$filebase.csv"; open FILE_OUT, ">$csvFile" or die ...; . . foreach my $parent (@parents) { print FILE_OUT $parents{$parent} . "\n"; } close FILE_OUT; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: readdir and print file issue
by ikegami (Patriarch) on Sep 28, 2007 at 18:59 UTC | |
|
Re: readdir and print file issue
by graff (Chancellor) on Sep 29, 2007 at 15:28 UTC |