Hello,
I have a three dimensional hash with info like below.
%LPAR_config = ( 'lpar1' => { 'profile1' => { ... }, 'profile2' => { ... }, 'frame' => 'frame1', 'lpar_id' => '1' } 'lpar2' => { 'profile1' => { ... }, 'profile2' => { ... }, 'frame' => 'frame1', 'lpar_id' => '2' 'lpar3' => { 'profile1' => { ... }, 'profile2' => { ... }, 'frame' => 'frame2', 'lpar_id' => '1' } 'lpar4' => { 'profile1' => { ... }, 'profile2' => { ... }, 'frame' => 'frame2', 'lpar_id' => '2' ... )
I've skipped the original list, as it has 191 lpars and each a lot of info. At one point in the program I need to get the name of the lpar from frame2 with lpar_id 1.
I'm now looping trough the keys to check if the lpar with name $key is on frame "frame2" and has lpar_id 1.
As I can skip most of the entries I was wondering, is there an easier way to get the key based on the content of the values of $key
On a related note, is there an easy way (read without looping myself) to copy a subset of the hash (for example all lpars on frame2) to another hash? This would speed-up the script, as most data is needed of just 1 frame (of 14 available)
In reply to Easy way to find data in hash or get subset of hash by T_I
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |