E
ExecMan
Hi,
I have a somewhat complex hash array, below. I want to know how to
access individual items within the inner hash.
With the example below, say I need the SUBJECT: $subj =
$SERVICES{'tactical'}->{subject};
However, say I need to get the COMMAND from the ALERT array with the
name SENDBUY. The value I am looking for is: trader.pl -B
But I am not sure how to turn the ALERT item into a hash so I can
access it by value, rather than by an array index.
Can anyone help??
%SERVICES = (
'tactical' => {
'service' => "tactical",
'url' => "tacticaltrader",
'from' => "Tactical Trader <tacticaltrader\@mail.com>",
'mailer' => "Tactical Trader Mailer",
'subject' => "Tactical Trader Summary",
'alert' => [
{ 'name' => "GENERATE", 'html' =>
"sid=group_id=29&ctype=0", 'command' => "eod-trader.pl -t -M",},
{ 'name' => "GENERATEBUY", 'html' =>
"sid=group_id=29&ctype=1", 'command' => "trader.pl -t -B -M",},
{ 'name' => "GENERATESELL", 'html' =>
"sid=group_id=29&ctype=2", 'command' => "trader.pl -t -S -M",},
{ 'name' => "SEND", 'html' =>
"sid=group_id=29&ctype=0", 'command' => "eod-trader.pl",},
{ 'name' => "SENDBUY", 'html' =>
"sid=group_id=29&ctype=1", 'command' => "trader.pl -B",},
{ 'name' => "SENDSELL", 'html' =>
"sid=group_id=29&ctype=2", 'command' => "trader.pl -S",},
{ 'name' => "GENERATEINTRA",'html' =>
"sid=group_id=29&ctype=3", 'command' => "trader.pl -t -I -M",},
{ 'name' => "SENDINTRA", 'html' =>
"sid=group_id=29&ctype=3", 'command' => "trader.pl",},
],
},
)
I have a somewhat complex hash array, below. I want to know how to
access individual items within the inner hash.
With the example below, say I need the SUBJECT: $subj =
$SERVICES{'tactical'}->{subject};
However, say I need to get the COMMAND from the ALERT array with the
name SENDBUY. The value I am looking for is: trader.pl -B
But I am not sure how to turn the ALERT item into a hash so I can
access it by value, rather than by an array index.
Can anyone help??
%SERVICES = (
'tactical' => {
'service' => "tactical",
'url' => "tacticaltrader",
'from' => "Tactical Trader <tacticaltrader\@mail.com>",
'mailer' => "Tactical Trader Mailer",
'subject' => "Tactical Trader Summary",
'alert' => [
{ 'name' => "GENERATE", 'html' =>
"sid=group_id=29&ctype=0", 'command' => "eod-trader.pl -t -M",},
{ 'name' => "GENERATEBUY", 'html' =>
"sid=group_id=29&ctype=1", 'command' => "trader.pl -t -B -M",},
{ 'name' => "GENERATESELL", 'html' =>
"sid=group_id=29&ctype=2", 'command' => "trader.pl -t -S -M",},
{ 'name' => "SEND", 'html' =>
"sid=group_id=29&ctype=0", 'command' => "eod-trader.pl",},
{ 'name' => "SENDBUY", 'html' =>
"sid=group_id=29&ctype=1", 'command' => "trader.pl -B",},
{ 'name' => "SENDSELL", 'html' =>
"sid=group_id=29&ctype=2", 'command' => "trader.pl -S",},
{ 'name' => "GENERATEINTRA",'html' =>
"sid=group_id=29&ctype=3", 'command' => "trader.pl -t -I -M",},
{ 'name' => "SENDINTRA", 'html' =>
"sid=group_id=29&ctype=3", 'command' => "trader.pl",},
],
},
)