http://www.perlmonks.org?node_id=1029866


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?