M
Martin Foster
Hello
I'm scanning text files into a database.
My perl script looks like this:
# start loop of file to scan for data
while (defined ($_2 = <INFILE>)){
# Find cell data
if ($_2 =~ m/_cell_length_a\s+(-?([0-9]+(\.[0-9]*)?|\.[0-9]+))/){
$cell[0] = $1;
print "Found cell parameter a= ", $cell[0], " ";
print "For str_id number ", $au_id, "\n";
# Insert data
$stmt1 = "UPDATE bgb_data SET latpar_a = ? WHERE str_id = ?";
$sth = $dbh->prepare($stmt1);
$sth->execute($cell[0], $au_id);
}
# get sequences
if ($_2 =~ m/_Sequence/){
# start loop to scan in sequences
So now I've found a tag and the next few lines are number sequences
which
I want in an array.
I want to scan in those lines into until a blank line appears and then
continue scanning for further data, in the while loop.
How can I do this?
Many thanks for any help!
Cheers,
Martin
I'm scanning text files into a database.
My perl script looks like this:
# start loop of file to scan for data
while (defined ($_2 = <INFILE>)){
# Find cell data
if ($_2 =~ m/_cell_length_a\s+(-?([0-9]+(\.[0-9]*)?|\.[0-9]+))/){
$cell[0] = $1;
print "Found cell parameter a= ", $cell[0], " ";
print "For str_id number ", $au_id, "\n";
# Insert data
$stmt1 = "UPDATE bgb_data SET latpar_a = ? WHERE str_id = ?";
$sth = $dbh->prepare($stmt1);
$sth->execute($cell[0], $au_id);
}
# get sequences
if ($_2 =~ m/_Sequence/){
# start loop to scan in sequences
So now I've found a tag and the next few lines are number sequences
which
I want in an array.
I want to scan in those lines into until a blank line appears and then
continue scanning for further data, in the while loop.
How can I do this?
Many thanks for any help!
Cheers,
Martin