Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

kcott's scratchpad

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

<img src="http://www.perlmonksflair.com/kcott.jpg" alt="PerlMonks Badge: kcott" title="PerlMonks Badge: kcott. See http://www.perlmonksflair.com/." />

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?
[Discipulus]: lazy? virtualbox is pretty no-setup software

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2018-07-23 11:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (465 votes). Check out past polls.

    Notices?