in reply to Re^6: readline() on unopened filehandle
in thread readline() on unopened filehandle

What about:

foreach my $filename ( @files ) { open ( FILE, "<", $filename ) or die( "Couldn't open $filename: $!" ); my $batch = ""; INNER: while ( <FILE> ) { $batch .= $_; last INNER if eof || m/^\s*go\s*$/i; } $dbh->do( $batch ) if ( $batch =~ m/^\s*go\s*$/msi ); }

It has the advantage of resetting $batch each time, rather than executing the batch from the first file for every subsequent file.

And what do you know? This looks an awful lot like ikegami's code in Re^4: ALTER SPROC activation, which was the answer you got the last time you asked this question.

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.