in reply to Re^2: How can I delete a key' value from a hash
in thread How can I delete a key' value from a hash
Just for your information:
printf "After deleting: state=%s zip= %s\n", $location_hash->{ $city }->{ 'ST' }, $location_hash->{ $city }->{ 'ZIP' };
This code will re-create the key $city} in %$location_hash. $location_hash->{$city} has to exists before it can look up ST and/or ZIP. (autovivication)
Another note: $location_hash->{$city}->{'ST'} is the same as: $location_hash->{$city}{'ST'} which is the same as: <code>$location_hash->{$city}{ST}
|
|---|