I am working on a script and am trying to get some value from an array stored in a hash. After searching on Google, searching for questions on SO (and there are some similar titles, but those who have remained unresolved or the problems are slightly different compared to me), and everything to check out and try After making a reasonable effort, I have come to ask for your help.
I have a hash, For example, give me This is the array of hash, try this way: See more details. Updated Example: $ action , and an array,
$ action-> {'Event'} is . Here is the output for
print dumper ($ Action-> {'events'}); :
$ VAR1 = [{'mute' = & gt; 'Something', 'Role' = & gt; 'Something', 'Event' = & gt; 'Some', 'channel' = & gt; 'Something', 'Talking' = & gt; 'Some', 'Username' = & gt; 'Somnmar', 'CallerIdname' = & gt; 'Somnmar', 'Conference' = & gt; 'Somnmar', 'Marked Ususer' = & gt; 'Some', 'ActionID' = & gt; 'Somnmar', 'Callardium' = & gt; 'Somnmar', 'Admin' = & gt; 'something' }];
$ action-> {'EVENTS'} - & gt; {CallerIDName '} is required to get the value, but this syntax and many other things will not work I have tried
$ action-> {'Events'} [6] and
$ action- & gt; {'Events'} - & gt; [6] and try to do so.
$ Action-> {'EVENTS'} [0] - & gt; {'CallerIDName'}
Use Strict; Use warnings; Use data: Dumper; My $ action = {}; $ Action-> {'Event'} = [{'mute' = & gt; 'Something', 'Role' = & gt; 'Something', 'Event' = & gt; 'Some', 'channel' = & gt; 'Something', 'Talking' = & gt; 'Some', 'Username' = & gt; 'Somnmar', 'CallerIdname' = & gt; 'Somnmar', 'Conference' = & gt; 'Somnmar', 'Marked Ususer' = & gt; 'Some', 'ActionID' = & gt; 'Somnmar', 'Callardium' = & gt; 'Somnmar', 'Admin' = & gt; 'something'}]; Push the hash (@ {$ action-> gt; {'events'}}, {' mute '= & gt; some', 'role' = & gt; 'some 1', 'event' = & gt;; 'Some 1', 'channel' = & gt; 'some 1', 'talking' = & gt; 'some 1', 'user number' = & gt; 'Monday 1st', 'caller idname' = & gt; ; 'Somnar 1', 'Conference' => 'Soman 1', 'Marked Ususer' = '1', 'ActionID' => 'Somnar 1', 'CollarIdNam' = & gt; 'Monday 1st', 'Admin' = & gt; 'some 1'}); (My $ i = 0; $ i & lt; @ {$ action- & gt; {'events'}} $ i ++) {print dumper ($ action-> {events} [$ i]) ; # All print print prints dumper ($ action-> {'event'} [$ i] - & gt; {'CallerIDName'}) array index $ i #print caller id key (any key) Hash; }
Comments
Post a Comment