in reply to Print and Die!
my %HostInfo = ( dell => {connectstr=>"DBI:mysql:nikos_db", user=>"root", pas +s="XXXX"}, __DEFAULT__ => {connectstr=>"DBI:mysql:nikos_db:50free.net", user=> +"nikos_db", pass="XXXX"} ); my $hostIdx = $host; if (not exists $HostInfo{$hostIdx)){ $hostIdx ="__DEFAULT__"; } if ($db = DBI->connect($HostInfo{$hostidx}{connectstr},$HostInfo{$host +idx}{user}, $HostInfo{$hostidx}{pass})){ # Connect OK }else{ print font( {-size=>5, -color=>'Lime'}, $DBI::errstr ); exit(); }
Update: Changed "exist" to "exists" .. I still havent verified Synax...
"When you are faced with a dilemma, might as well make dilemmanade. "
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |