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. "
In reply to Re: Print and Die!
by NetWallah
in thread Print and Die!
by Nik
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |