in reply to how to hash this


On a tangent, my experience may or may not be useful, but here's what i've tried in the past.

Since you're trying to read in a record, you might consider making a record object. Than you can say something like this to read in a record:

use myRecord; open FILE, $file or carp "Couldn't open file $file: $!"; while (my $record = new myRecord(\*FILE)) {
And the new method in the myRecord class would take the filehandle, do some appropriate checks (if it's open, if the first line you read contains the begin block for the record; useful stuff) and store the newly read record in the object. Then you make the typical accessor methods to get at whatever you need, and the object behaves (relatively) like a hash.

The advantages of this style of coding is that if the format ever changes (and it will sometime) you can go into the object and change the way it reads without having to change any part of the rest of the program. It also allows you to sling the records around a little more easily as they're encapsulated.

The disadvantages are that you now have to check the filehandle and you have to write the object in the first place :-)

It's up to you, HTH,
jynx