sub create_database { print "Please enter the hostname:"; chomp($hostname = ); print "Please enter the name of the new MySQL database:"; chomp($database = ); $dsn = "dbi:$driver::$hostname:$port"; print "Please type the MySQL root username:"; chomp($username = ); print "Please type the MySQL root password:"; chomp($password = ); $dbh = DBI->connect($dsn, $username, $password); $result = $dbh->do("create database `$database`"); $dbh->do("use `$database`"); if($result) { say "Database '$database' created successfully"; } else { say "Database '$database' creation failed"; exit; } }