thanks for the humor... hehe, i don't know if this is the correct (or most senceable) 
way, i just want to lean stuff stuff stuff...  anyway, 
because you mentioned it, what is an example of the php syntax to do the same?  sounds 
more doable?
maybe i will try that too, but not naked...  hehe
thanks for your real answer matt

bc


Daniel Gardner <[EMAIL PROTECTED]> wrote on 1/27/02 4:18:59 PM:
>
>Sunday, January 27, 2002, 3:03:03 PM, Matt C. wrote:
>
>> There's a module called DBD::CSV, which will probably solve your problem. CPAN is
>> good at that :).  You can tell it what the field separator is and then you'll be
>> able to manipulate it however you want with the DBI. I believe you'll need to
>> install the bundle, found here: 
>
>
>I hate to say it, but this guy can't even manage to read
>from a file, telling him to go and use *anything* from CPAN
>is probably much like telling him that he should sacrifice a
>chicken and dance naked under a full moon - both suggestions
>are about as likely to be as effective.
>
>
>Taking strictly from what the guy wants to do (which bears
>little relation as to what the guy should do) this should do
>the trick:
>
>  #!/usr/bin/perl -w
>
>  use strict;
>
>  open INFILE, "text.csv" or die "Can't open text.csv: $!";
>  while (<INFILE>) {
>     print "insert into TABLENAME id,first,last VALUES ($_);\n";
>  }
>
>of course this assumes that all of the data in text.csv is
>properly quoted. If it's not then that'll fail dismally.
>
>and just as an aside to the OP, why not use php to do this?
>if you know that, then why try and get another language that
>you don't know involved?
>
>
>> --- bc <[EMAIL PROTECTED]> wrote:
>>> i have a mdb db, i use with asp
>>> 
>>> i want to switch to php
>>> 
>>> i want to use perl to convert the csv produced from this mdb to make a many many
>>> lined sql statement for my php db, in order to get the 
>>> data to it
>>> 
>>> so in perl, how do i turn each line of csv data into sql statements by adding
>>> "insert into"... etc etc...
>>> 
>>> i want to take 44, jon, doe, 3479, alabama
>>> 
>>> and add "insert into TABLENAME id, first, last, number, state VALUES ("
>>> $the_csv_string_one_per_row ")";
>>> 
>>> so in my linux websever's cgi-bin directory, what will the pl script look like:
>>> 
>>> ex:
>>> 
>>> #!/user/bin/perl
>>> open (infile, "text.csv");
>>> @indata = infile;
>>> foreach???
>>> 
>>> something like this?
>>> 
>>> thanks a ton, i've gotten a lot of error's trying to do this for days...?
>>> 
>>> bc
>>> 
>>> 
>
>
>
>-- 
>Best Regards,
>Daniel                   [EMAIL PROTECTED]
>
>
>-- 
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to