http://qs321.pair.com?node_id=476966

hmbscully has asked for the wisdom of the Perl Monks concerning the following question:

After nearly five years of working with Perl, I must admit, I still cannot grasp when or how to use a hash. My chapter 5 of the llama is just one big block of highlighting and pencil question marks.

Here's the situation that has made me think its time to figure this out:

I have a registration form collecting, among other things, standard address information from the user. The form data is then dealt with via a script. In the end, the script needs to write the data to one of 7 different csv files based on which state was submitted. I have a list of the states that will comprise each file.

In my head it makes perfect sense that I should look at the state and then if state = blah, then write that line to file = eh. But I can't understand or see what structure I should use to do this. Should I put each list of states into an array? Somehow I think there should be a hash used.

Many TIA. ~WD