in reply to Accessing an array of anonymous hashes
For the particular problem you're approaching, it looks like the structure of a list of pairs is quite adequate.
With the list of pairs, you get the features:( Batch_Agency => { range => [ 1 .. 3] }, Batch_Date => { range => [ 4 .. 11] }, Batch_Type => { range => [ 12 .. 12 ] } }
Beware of using the ranges as you mentioned (range => [1 .. 3]). They can become a burden to maintain as fields are added or change size. It would probably be more useful to work only with lengths and compute automatically the range (if needed). Something like length => 3 or format => 'A3'.
If you decide to avoid the suffering of writing and maintaining the code for producing these streams of fixed-format records, you may try some modules from CPAN. Among them, Data::FixedFormat and AnyData::Format::Fixed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Accessing an array of anonymous hashes
by thezip (Vicar) on Mar 26, 2007 at 18:50 UTC |