in reply to Can't call method "do" on an undefined value error

It's $db that's undefined, not $dbname