in reply to Urgent help !!!!

> my $sql = "SELECT * INTO OUTFILE 'g:/dbf2csv/$filename'
> FIELDS TERMINATED BY ','
> LINES TERMINATED BY '\r\n' FROM reg501";

That syntax is specific to MySQL and won't work with DBD::CSV. You can accomplish the same thing like this:

$dbh->{csv_files}->{outfile} = { file => "g:/dbf2csv/$filename", sep_char => ',', eol => '\r\n' }; $dbh->do(" CREATE TABLE outfile AS SELECT * FROM sourceTable ");