#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $hashref = { 'Inventory' => { 'lb' => "abc", 'host' => [{ 'hostA' => { 'os' => "Linux",'location'=>"Dublin"}}, {'hostB' => {'os'=> "Windows",'location'=>"US"}}, {'hostC' => {'os'=>"Ubuntu",'location'=>"Germany"}} ] } } ;