Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

kcott's scratchpad

by kcott (Abbot)
on Sep 22, 2010 at 21:42 UTC ( #861372=scratchpad: print w/ replies, xml ) Need Help??

For Tux:

#!/usr/bin/env perl -l use strict; use warnings; use Text::CSV; my $csv = Text::CSV::->new(); my $cols = @{ $csv->getline(\*DATA) }; my $query = 'INSERT INTO table (' . join(',' => map { "col$_" } 1 .. $ +cols) . ') VALUES (' . join(',' => ('?') x $cols) . ')'; print $query; __DATA__ a,b,c,d

Output:

INSERT INTO table (col1,col2,col3,col4) VALUES (?,?,?,?)

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2015-07-30 18:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls