in reply to Multiple Hashes are stressing me
Hashes are inherently unsorted, so let's seperate combining the hashes from sorting and printing them:
If you need the sorted keys for more than the print, you could save them in an array of their own.#!/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;
After Compline,
Zaxo
|
|---|