What do you think about this structure?
my $transaction_record_fields = {
'Batch_Agency' => { COL => 0, POS => [ 1 .. 3] },
'Batch_Date' => { COL => 1, POS => [ 4 .. 11] },
'Batch_Type' => { COL => 2, POS => [ 12 .. 12] },
};
Eventually, I'll be inserting some data into each column, so it will end up looking like this:
my $transaction_record_fields = {
'Batch_Agency' => { COL => 0, POS => [ 1 .. 3], VALUE =>
+ "AAA" },
'Batch_Date' => { COL => 1, POS => [ 4 .. 11], VALUE =>
+ "BBBBBBBB"},
'Batch_Type' => { COL => 2, POS => [ 12 .. 12], VALUE =>
+ "C"},
};
I like the idea of being able to insert by fieldname rather than by a numeric index, and this structure supports that.
OTOH, that fact that I have to hard-code the column index seems a little funky to me.