use DBI; my $hostname=""; my $database=""; my $user=""; my $password=""; my $dbh; #------------------------------------------------------------- db_connection(); Ausgabe(); #------------------------------------------------------------- sub Ausgabe { my $sth = $dbh->prepare("SELECT * FROM SCN_Main_Server")or die "Fehler: ", $dbh->errstr(); $sth->execute(); while($ref = $sth->fetchrow_arrayref) { print "
$ref->[1]
"; } $sth->finish(); $dbh->disconnect(); } sub db_connection { $dbh = DBI->connect("DBI:mysql:database=$database;host=$hostname",$user, $password, {RaiseError => 1}); }