#perl -w ... my %attr = ( socket => '/somewhere/mysql/mysql.sock' ); my $dbh = DBI->connect( "dbi:mysql:$db:$server", $user, $pw, \%attr ); ...