use strict; use warnings; use List::MoreUtils qw(mesh); use Data::Dumper; my @array = ('source|ex|stat|ex2|desc|dep|ind'); my @columns = qw; my @AoH; foreach (@array) { push @AoH, { mesh(@columns, @{[split /\|/,(shift @array)]}) } ; }; print Dumper @AoH; #### C:\>perl test.pl $VAR1 = { 'source_id' => 'source', 'desc' => 'desc', 'status' => 'stat', 'depth_indic' => 'ind', 'depth_flag' => 'dep', 'exchange_id' => 'ex', 'exchange' => 'ex2' }; C:\>