in reply to if expression

if $line not =~ (/INSERT INTO Message_pool)/{

From perlsyn:

if (EXPR) BLOCK elsif (EXPR) BLOCK ... else BLOCK

The parens are optional on the statement modifier form of if, but not in the flow control case. Additionally:

$line not =~ (/INSERT INTO Message_pool)/

is not valid. You want either:

( not $line =~ m/INSERT INTO Message_pool/ ) # or more likely ( $line !~ m/INSERT INTO Message_pool/ )

But perhaps the real question is why you test a condition to discard it, rather than combining this condition with the next... actually, I started to rewrite your conditional based on what I thought that you meant, but I can't figure it out. Is the second condition not unreachable? If the line is not an INSERT, do nothing, otherwise if it is a CREATE do something? It has to be both an INSERT and a CREATE.

Other questions/comments:

updated