#!/usr/bin/perl -w use strict; my %hash1 = qw( 2 cars 1 motorcycle 4 balloons ); my %hash2 = qw( 5 airplanes 3 helicopters 6 skateboards ); # combine my %hash = (%hash1, %hash2); # print sorted print map "$_ $hash{$_}\n", sort {$a<=>$b} keys %hash;