well, there may be more efficient means but something like this shoudl do the
trick.
sub returnkey {
foreach $zipcode (keys %hash) {
if ( $hash{$control} eq $cityname ) { return $zipcode; }
}
}
~jon
--- Big Bird <[EMAIL PROTECTED]> wrote:
> I'm converting a massive fixed width file to a delimited one, but the file
> has some fields missing. It's my job to try to deduce the value of each
> missing field from another one present in that line of the file. One
> example is deducing the missing zip code given the city field.
>
> I have a hash of zipcode-city pairs. Since a city may have more than one
> zip code, the zipcodes are the keys. If there is exactly 1 value in the
> hash that matches the city in the line of the file, I need to get the key
> for that value, but how can I do it?
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
>
=====
==========================================================
"Did you ever wonder if the person in the puddle is
real, and you're just a reflection of him?"
- Calvin (from Calvin & Hobbes)
==========================================================
Rev. Jonathan T Sage [-WiSE-] [[EMAIL PROTECTED]]
HTTP://www.wisefreebsd.org
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/