D
Dave Sisk
Hi Folks:
I need the right regex to match either a comment line (--) or a blank line.
What I've got below doesn't seem to be working like I'd expect. I've posted
a snippet of what I have below...would anyone be kind enough to point me in
the right direction? I also apparently need to strip the ';' off the end
of the INSERT statement...
TIA,
Dave
-----------------------------------------------------------
while(<SCRIPT>) {
chomp;
$insert = $_;
unless ($insert =~ /^--|^\s+$\n/) {
$rv = $dbh->do($insert);
}
}
The script I'm reading in looks like this:
-- Some comments on this line, the next line is a blank line, then the next
lines are inserts.
insert into sometable values('whatever1');
insert into sometable values('whatever2');
etc.
I need the right regex to match either a comment line (--) or a blank line.
What I've got below doesn't seem to be working like I'd expect. I've posted
a snippet of what I have below...would anyone be kind enough to point me in
the right direction? I also apparently need to strip the ';' off the end
of the INSERT statement...
TIA,
Dave
-----------------------------------------------------------
while(<SCRIPT>) {
chomp;
$insert = $_;
unless ($insert =~ /^--|^\s+$\n/) {
$rv = $dbh->do($insert);
}
}
The script I'm reading in looks like this:
-- Some comments on this line, the next line is a blank line, then the next
lines are inserts.
insert into sometable values('whatever1');
insert into sometable values('whatever2');
etc.