Tuesday, August 27, 2013

Cannot insert perl array in database

I recently came across a problem where my perl array was generating some random value in MySql query. I finally figured out that, you have to convert perl array to string first and then can insert in the database. Here is how you can do it:

my @arrayData = ("aaa","bbb","ccc");
my $ArrayString = join " ", @arrayData;

use above variable in MySql query.

Cheers. 

No comments: