perlquestion
master_son
Hello monks;
The following is the code that I am using to upload a *.csv file via CGI and write its contents to another *.csv file However, when the destination file is written, I get blank rows in between each record.
<br />
<code>
my $upload_dir = "some directory";
my $evtFileName = 'testDoc';
my $empFileName = $query->param('filepath');
my $fh = upload('filepath');
$fh =~ s/(?=\n)/\r/g;
open OUTFILE, ">".$upload_dir."\\".$empFileName or die "Cannot open file ".$upload_dir."\\".$empFileName;
while (<$fh>)
{
print OUTFILE;
print;
}
close OUTFILE;
</code><br />
I am using CGI qw(:standard) and CGI::Simple CPAN modules for this<br /><br />
The code above contains the regex
<code>$fh =~ s/(?=\n)/\r/g;</code> which I received earlier that is to convert UNIX or MAC CRs to DOS CRs. I was able to get it to do the work, but now it will not operate properly.<br /><br />
What am I doing wrong - or is there a good solution. Thank you in advance.<br /><br />
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-514928">
EDIT: Sorry - I am running the script on Windows 2003 Server (DOS)
---------------------<br />
Keep your concentration here and now where it belongs - <strong>Qui-Gon Jinn</strong>
</div></div>