in reply to Re^3: how to put this db connection code into a function
in thread how to put this db connection code into a function

sub connect { return DBI->connect( "DBI:mysql:".join(';', "database=$sql_database", "host=$sql_host", "port=$sql_port", ), $username, $password, { RaiseError => 1, AutoCommit => 1, }, ); } my $dbh = eval { connect() } or die("Can't connect: $@");