$data_array_ref = [ mykey1 => {firstkey => 'firstvalue', secondkey => 'secondval' }, mykey2 => {ninza => 'turtle', 'Hurricane' => 'Dennis'}, mykey3 => [ ['one', 'two', 'three'] ], mykey4 => [ [4, 5, 'three'], [6, 7, 'four'], [8, 9, 'five'] ], ]; my $i = 0; while ($i < @$data_array_ref) { my $key = $data_array_ref->[$i++]; my $val = $data_array_ref->[$i++]; print "$key => "; if (ref($val) eq 'HASH') { print join ', ', values %$val; } else { print join ', ', map { @$_ } @$val } print "\n"; } __END__ output ====== mykey1 => firstvalue, secondval mykey2 => turtle, Dennis mykey3 => one, two, three mykey4 => 4, 5, three, 6, 7, four, 8, 9, five