in reply to A Problem With Hashes and Keys

I'm really not sure if you asked a question or not. =) I noticed that you don't appear to be using your $add_file at all in the code, too.

Anyway, a technique that seems to be more sane to me is one where you:

  1. Read/parse $raw_zip, and populate a %master hash.
  2. In a while loop reading from $delete_file, check if the key (in %master) for each line exists, and delete that key.
  3. Do similar for $add_file, adding entries to %master as requested.
  4. Finally, walk back over the %master hash, and output back to your original file.
How does that sound to you?

Update: I saw that file format for the "master" file. I would populate it like so, if you do something like I said above:

my ($state, $zip) = split; $master{$zip} = $state;
I am assuming that there won't be any duplicate lines in your file, also.

mhoward - at - hattmoward.org