require DBI; # laden des DBI-Moduls my $db_user   = ''; my $db_passwd = ''; my $dsn = 'DBI:mysql:spiel:localhost';  # datasourcename:  wenn myserver weggelassen wird,                             # wird standardmäßig localhost verwendet. my $attributes = { PrintError => 0, RaiseError => 0, "AutoCommit" => 1, }; # siehe Doku zu DBI my $dbh = DBI->connect($dsn, $db_user, $db_passwd, $attributes)    #or main::writeDbhError($dbh, "Error in connecting to $dsn", die => 1);    or main::writeDbhError("Error in connecting to $dsn", die => 1);  # immer Returncodes und Fehler auswerten!!! my $table = "spieler"; my $statement = "SELECT name, passwd from $table"; unless ($dbh->do($statement)) {  main::writeDbhError($dbh, "Error in executing Sql-Statement:\n\t$statement"); } my $hash_ref = $dbh->fetchrow_hashref; $dbh->disconnect();