#!/usr/bin/perl use warnings; use strict; use Hash::Diff qw( diff ); use Data::Dumper qw(Dumper); my %hash; my @fruits = ("Fruit","Fruit1","Fruit3","Fruit4"); my @fruit_names = ("apple", "orange", "strawberry", "grape"); my @fruits_2 = ("Fruit","Fruit1","Fruit3","Fruit4"); my @fruit_names_2 = ("apple", "orange", "strawberry", "grapes"); # Approach one creating hash with 2 arrays for (0..$#fruits) { $hash{$fruits[$_]} = $fruit_names[$_]; } # print Dumper \%hash; # Approach two creating hash with 2 arrays my %hash_2; @hash_2{@fruits} = @fruit_names; # print Dumper \%hash_2; my %hash_3; @hash_3{@fruits_2} = @fruit_names_2; # print Dumper \%hash_3; my %hash_diff = %{ diff( \%hash_3, \%hash_2 ) }; print Dumper \%hash_diff; __END__ $ perl test.pl $VAR1 = { 'Fruit4' => 'grapes' };