in reply to Re^2: Text::CSV not able to execute insert query dynamically.
in thread Text::CSV not able to execute insert query dynamically.

Did you try the suggested code for your insert? Sorry for any lack of clarity in the explanation.

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

  • Comment on Re^3: Text::CSV not able to execute insert query dynamically.

Replies are listed 'Best First'.
Re^4: Text::CSV not able to execute insert query dynamically.
by Ankur_kuls (Sexton) on Sep 23, 2014 at 20:00 UTC

    Hi..sorry for late reply..was off work :) Thanks a lot..It works perfectly. But could you please explain it little further...how u used do block? Thanks again..:)

      A do block just executes the contained code and returns the last thing that was evaluated. In this context, I use it to create a tight scope for the $count and $qs variables. It is functionally equivalent to
      my $count = @$columns; my $qs = join ',', ('?') x $count; my $sql = <<EOSQL; INSERT INTO VoucherMRPDataTable_Frt_TariffModel VALUES ($qs) EOSQL
      except that in the latter case, you'll be carrying around two more variables, one of which has a very generic name.

      Does that clarify things?


      #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.