in reply to Comparing two hashes
#!/usr/bin/perl use warnings; use strict; my %giant = ( fee => 'fi', fo => 'fum', I => 'smell' ); my %mouse = ( eeeny => 'meeny', miny => 'mo', nose => 'smell' ); my $out = "giant\{%s\} equals mouse\{%s\}\n"; for my $g ( sort keys %giant ) { for my $m ( sort keys %mouse ) { printf $out, $g, $m if ( $giant{$g} eq $mouse{$m} ); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Comparing two hashes
by ruzam (Curate) on Apr 02, 2010 at 02:06 UTC | |
by dwm042 (Priest) on Apr 02, 2010 at 18:06 UTC | |
by ruzam (Curate) on Apr 03, 2010 at 04:00 UTC |