sub db_function { my $dbh = shift; my $str = shift; $sql = "SELECT *.... where blablabla = '$str'"; my $sth = $dbh->prepare($sql) or die 'Fehler:', $DBI::errstr, "\n"; $sth->execute(); # wird der Status 1 oder 0 in $result gespeichert my $result = $sth->fetchrow_array(); # oder alles in einem Array speichern # my @result = $sth->fetchrow_array(); return $result; } $dbh = DBI->connect("dbi:Oracle:$db_name",$db_username,$db_password, \%attr) or die "Fehler beim Datenbankconnect: $DBI::errstr"; my $db_result = db_function($dbh,$string); print "$db_result\n"; $dbh->disconnect();