Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Parsing Pipe Delimited Multi-line File

by valentin (Abbot)
on Feb 04, 2004 at 18:41 UTC ( [id://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|

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-19 03:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found