Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: Converting array of hash references to hash

by hdb (Prior)
on Apr 22, 2013 at 13:22 UTC ( #1029866=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Converting array of hash references to hash
in thread Converting array of hash references to hash

I do not understand. If I run:

use strict; use warnings; use Data::Dumper; my $ams_hosts = [ { 'domainId' => '1', 'deviceIp' => '172.16.133.56', 'deviceType' => 3, 'deviceName' => 'AMS' }, { 'domainId' => '1', 'deviceIp' => '172.16.133.57', 'deviceType' => 3, 'deviceName' => 'ams_57' } ]; my %ams_ips_hash = map { $_->{'deviceIp'} => 1 } @{$ams_hosts}; print Dumper( \%ams_ips_hash );

I get

$VAR1 = { '172.16.133.56' => 1, '172.16.133.57' => 1 };

Can you clarify what you mean please?


Comment on Re^3: Converting array of hash references to hash
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1029866]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2014-11-28 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (200 votes), past polls