in reply to save the result of sql query in csv file

Use DBD::CSV. That will solve all of the problems mentioned above about embedded commas, embedded newlines, adding column names, etc.
  • Comment on Re: save the result of sql query in csv file