
rajivcj12
New User
Dec 30, 2015, 12:46 AM
Post #1 of 7
(3538 views)
|
Extracting values from Hash
|
Can't Post
|
|
Hi, A little help would be much appreciated. I am trying to extract the key value pairs from a multidiamentional hash that looks link the following
$VAR1 = { 'result' => [ { 'record' => [ { 'ttl' => '86400', 'Line' => 1, 'type' => ':RAW', 'raw' => '; cPanel first:11.52.1.3 (update_time):1451457515 Cpanel::ZoneFile::VERSION:1.3 hostname:vps-1169473-23827.xxxx.xxxx.com latest:11.52.1.3' }, { 'ttl' => '86400', 'Line' => 2, 'type' => ':RAW', 'raw' => '; Zone file for mhest.com' }, { 'ttl' => '14400', 'Line' => 41, 'name' => 'mhest.com.mhest.com.', 'address' => '192.168.5.38', 'class' => 'IN', 'type' => 'A' }, { 'ttl' => '14400', 'Line' => 42, 'name' => 'mhest.com.', 'address' => '192.168.2.4', 'class' => 'IN', 'type' => 'A' } ], 'statusmsg' => 'Zone Serialized', 'status' => 1 } ] }; What I really want to do here is get the line number of the record with the ip 192.168.2.4 I am not really into using hashes. I decoded this from a json output cPanel api produces.
(This post was edited by rajivcj12 on Dec 30, 2015, 1:14 AM)
|