Hello,

I am trying to do an import of a Tab De-limited file and then 
extract certain fields.

I am looking to general comments and or a better more concise way of doing this,
Thanks in advance...

Dave Gilden -- Ft. Worth-less Texass

Here is what I have so far (and it is not tested and my be incorrect!)


###Perl Code###

open (FH, $fileIn) || "die Problem reading $fileIn $!\n";

while(<FH>){
push(@musicians, $_); 
} 
close FH;

  
foreach (@musicians){
chomp;

@tmpArray  = split(/\t/,$_); 

$ssNum = $tmpArray[0];
$fName = $tmpArray[3];
$lName = $tmpArray[4];
$zip = $tmpArray[8];
$city = $tmpArray[9];
$state = $tmpArray[10];
$memberStatus = $tmpArray[12];
$phone = $tmpArray[19];
$instrument = $tmpArray[21];
$email  = $tmpArray[33];


#### INSERT Into Data in to mySql Database ###################

# using place holders
$sql = "insert into $table_name values (null, ?, ?, ?, ?,?,?,?, ?, ?, ?);";
$sth = $dbh->prepare($sql);
$sth->execute($ssNum,$fName,$lName,$zip,$city,$state,$memberStatus,$phone,$instrument,$email);

## more  code.....
}




Visit my schedule page for up to the minute performance info:
<http://www.coraconnection.com/cgi-bin/schedule.pl>


==============================================
         Cora Connection: Your West African Music Source
              Resources, Recordings, Instruments & More!
                   <http://www.coraconnection.com/> 
==============================================

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to