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

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.