in reply to use of $_ is destroying @database ... why?

It's the
while ( <T>) {
in load_tbls. That modifies $_, which at that moment is an alias for the elements of @database.

Add a 'local $_' in your load_tbls sub.

Abigail