in reply to How to do with this hash?
he corrected it as:my %CountryCode = { 'com','Comercial', 'uk','The United Kingdom', } # a hash of country name
Note two things: 1) da changed your {}'s to ()'s (squiggles to parens) when intializing the hash; and 2) you left off a semicolon at the end of the statement.my %CountryCode = ( 'com','Comercial', 'uk','The United Kingdom' ); # a hash of country names
Another thing not mentioned is your snippet:
You should use ($Country eq $key) and not ($Country == $key).if ($Country == $key){ #get the key of country name $CountryName = $CountryCode($key); #assign the key value to a varia +ble }
|
|---|