in reply to Re^3: Accessing an array of anonymous hashes
in thread Accessing an array of anonymous hashes
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Accessing an array of anonymous hashes
by eric256 (Parson) on Mar 26, 2007 at 18:41 UTC |