use strict; use warnings; #definition AoA my $transaction_records = [ [ 'Batch_Agency' => [ 1 .. 3] ], [ 'Batch_Date' => [ 4 .. 11] ], [ 'Batch_Type' => [ 12 .. 12] ], ]; my $i = 0; #build a map of column name to column my $key_map = { map { $_->[0] => $i++ } @$transaction_records }; #then your rows could look like my $row1 = [ 'agc', '05-JAN-2007', 'type']; my $row2 = [ 'agc', '05-JAN-2007', 'type']; #and you could access data like $row1->[ $key_map->{Batch_Agency} ] = 'abc'; #multiple rows could look like my $rows = [ $row1, $row2]; for my $i ( 0,1,2) { print $transaction_records->[$i]->[0], " = ", $row1->[$i], "\n"; }