This code hangs up after the bit that prints 'I am here'. When I say 'hangs up' I mean it just keeps on running without finishing the program. I just want it to run the SPROC $FH.
while (<*.sql>) {
next if $_ eq 'Activate.sql';
$file = $_;
open (FILE, "$file");
my $line_number = 0;
my $run;
LINE: while (<FILE>){
my $line = $_;
$line_number = $line_number +1;
$run = 1;
if ($line_number == 1){
$run = 0 if $line !~ m/^ALTER\sPROCEDURE\s/;
last LINE;
}
else {
$run = 1;
}
last LINE;
}
if ($run == 1){
push (@files, $file);
}
else {
#Do nothing
}
}
print "@files";
foreach (@files) {
my $FH = $_;
open (FILE, "<$FH");
OUTER: while ((<FILE>)) {
my $line_B = $_;
print "\n\nI am here\n";
last if eof;
my $batch;
do {
$batch .= $line_B;
} until ($line_B =~ m/^\s*go\s*$/i);
$dbh->do($batch) if ($line_B =~ m/^\s*go\s*$/i);
last if ($line_B =~ m/^\s*go\s*$/i);
}
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.