in reply to DBI Sqlite insert function

In order to expand @values you should look at join. Still, I would suggest you to use a different approach regarding passing values to database queries.

You can start by looking at What are placeholders in DBI, and why would I want to use them?.

Replies are listed 'Best First'.
Re^2: DBI Sqlite insert function
by ScOut3R (Sexton) on Jul 01, 2008 at 13:57 UTC
    Ah sorry, i meant to split @values into separate values.

      From what I understand from your post, you want to convert the array @values to a string that has the array's values comma separated, as that would be the correct SQL syntax. So, if you have an array:

      @values = ( 1, 2, 3 );

      and you want to put that into the SQL query you'll have to join the values:

      my $str_values = join(', ', @values); # $str_values is now '1, 2, 3' ... $db->do("insert into $table values ($str_values)") ... ...

      Still, I strongly advise the reading of the info on placeholders.

        Thank You! That's what i needed!