in reply to Store and match

Your data looks a lot like a ".ini" or "config" file. I suggest looking at something like use Config::INI::Reader, there are other config readers.

Update: I don't think that I was clear at all. Sorry. The idea is to put the data into a standard file format and use one of the Perl modules to parse it for you. I've used some of these .ini or .config file parsers and they work very well. I think it is something to be seriously considered. A file could look like this:

[Note] note_value1 notes_value2 or [Note] values = value1, value2 [Book] novels = 211 magazines = "Scientific American", "Economist"