#!/usr/bin/perl -w use strict; my %hash; my %hash2; %hash = ('John', '-455.45', 'Jack', '-300.00', 'Tom', '-766.75'); %hash2 = ('Jack', '-200.00', 'John', '-44.25', 'Tom', '-999.23'); use Data::Dumper; print Dumper %hash2; print "\n"; use Data::Dumper; print Dumper %hash; my @calc; foreach my $key (keys(%hash2)) { my $value1 = $hash{$key}; my $value2 = $hash2{$key}; my $calc = $value1 - $value2; push (@calc, $calc); } print "The difference is:", "\n"; use Data::Dumper; print Dumper @calc;