in reply to Reading command output buffer

Well, you don't seem to have anything in $db (and aren't using strict or you would have seen that). But other than that you seem to be just going about it the hard way...

my $datetime = strftime( "%F.%T", localtime ); system( join( ' ', 'mysqldump -qce --single-transaction', $db, @valid_tables, '>', "> /backups/table_dumps/$db.$datetime", ) );

www.jasonkohles.com
We're not surrounded, we're in a target-rich environment!