Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use warnings; my $zip = '01234'; my %zips = ( "City One" => "04321", "City Two" => "01234", ); my ($zip_match) = grep { $zips{$_} eq $zip } keys %zips; print "\n $zip_match\n"; # 01234
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hash search and returning by value
by Eily (Monsignor) on Dec 09, 2014 at 15:46 UTC | |
by Anonymous Monk on Dec 09, 2014 at 16:04 UTC | |
by LanX (Saint) on Dec 09, 2014 at 16:08 UTC | |
by AnomalousMonk (Archbishop) on Dec 09, 2014 at 16:25 UTC | |
|
Re: Hash search and returning by value
by AnomalousMonk (Archbishop) on Dec 09, 2014 at 16:01 UTC |