# $c = { 'foo.com' => { dbname => 'foo', dbuser => 'foo', }, 'bar.com' => { dbname => 'bar', dbuser => 'bar', } }; sub param { my $param = shift; # get a request instance my $r = Apache::Request->instance(); # get the hostname my $host = $r->hostname(); return $c->{$host}->{$param}; }