http://qs321.pair.com?node_id=635770


in reply to How to read batches of SQL from a file in Perl

You can also make the iterator a little simpler by changing the record separator:
local $/="\ngo\n"; while(<IN>) { chomp; # now the entire statement is in $_... ... execute the SQL statement, with error checking, etc. }
The disadvantage is that $/ can't be a regex, so you can't handle upper/lower case, for example.

Michael