for lack of a better perl vocab ill do the best I can. I'm trying to
use a hash key call inside another one. Basically getting a key from
one hash and using that value in another call to get a key from another
hash. so something i'm doing in the syntax is incorrect. at the end
of the program i demonstrate the hard coding works but the second
command does not.
use strict;
use warnings;
my $db_con="PROD";
my %INST= (
PROD => {
fullname => "PRODUCTION",
dbhost => { "proddb" => {
sshcon => "",
sshtime => 0,
},
},
webhost1 => { "prodweb1" => {
websshcon1 => "",
sshtime => 0,
},
},
webhost2 => { "prodweb2" => {
websshcon2 => "",
sshtime => 0,
},
},
numweb => 2,
version => "8.1.7",
},
DEV => {
fullname => "DEVELOPMENT",
dbhost => { "devweb" => {
dbsshcon => "",
sshtime => 0,
},
},
webhost1 => { "devweb1" => {
websshcon1 => "",
sshtime => 0,
},
},
numweb => 1,
version => "9.2.0",
},
);
my %QUERIES = (
APPUSER => {
8.1.7 => {
count => q{ select count(*)
from my_table1
},
list => q{ select *
from my_table1
},
},
9.2.0 => {
count => q{ select count(*)
from my_table2
},
list => q{ select *
from my_table2
},
}
}
);
print $INST{$db_con}{version};
print "TEST 1\n" . $QUERIES{APPUSER}{9.2.0}{count};
print "Attempt to retreive version number from second reference that
relies on the value of $db_con\n";
print "TEST 2\n" . $QUERIES{APPUSER}{$INST{$db_con}{version}}{count};
_______________________________________________
Perl-Unix-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs