Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Parsing Pipe Delimited Multi-line File

by valentin (Abbot)
on Feb 04, 2004 at 18:41 UTC ( #326554=note: print w/ replies, xml ) Need Help??


in reply to Parsing Pipe Delimited Multi-line File

pseudo code

#!/usr/bin/perl use DBI; my $dbh = DBI->connect; my $sth = $dbh->prepare("INSERT INTO mytable ( name, street, city ) VA +LUES ( ?, ?, ? )"); $sth->execute; while(defined ( $_ = <DATA>) ) { chomp; # ??, name, street, ?, city, ida, id, ?? my @d = split /\|/, $_; $sth->execute($d[1], $d[2], $d[4]); } __DATA__ |John Smith|123 Any Street||Any City|KS|23568| |Mary Smith|123 Any Avenue||Any Town|KS|32546|


Comment on Re: Parsing Pipe Delimited Multi-line File
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://326554]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2014-08-02 08:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (55 votes), past polls