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 );