in reply to keeping context in a loop

how do i print the string and not the array value

I am guessing that you are seeing something like ARRAY(0x9b31880) in your SQL query text. This would be because $uword{ $key } is an array reference. If you want to see the text of all the elements in the referenced array, you could use something like join(' ', @{ $uword{ $key } } ). This may not be what you want either, but at least you would be seeing text.

If I have guessed incorrectly, you could post a sample of the output you are getting and describe what is wrong with it, and also post an example of what you want the output to look like.

You might find brian's Guide to Solving Any Perl Problem helpful. There is some very good advice there that would help you investigate and solve your problems.

You might also consider using $dbh->quote() to quote the strings you are inserting into your SQL statement.

Replies are listed 'Best First'.
Re^2: keeping context in a loop
by afoken (Chancellor) on Oct 26, 2010 at 14:38 UTC
    You might also consider using $dbh->quote() to quote the strings you are inserting into your SQL statement.

    Even better: Don't quote at all and use placeholders instead, especially when the SQL statement is executed repeatedly. That way, DBI and the database can cache a lot of the work that has to be repeated when not using placeholders. See Re: Counting rows Sqlite, Re^2: Massive Memory Leak, and of course the DBI documentation.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)