use strict; use Data::Dumper; my $ref = [ ['',''], ['',''], ['funct1','',''], ['',''], ['',['',['funct2a','funct2b',''],''],''], 'funct3', 'funct4', 'funct5', 'funct6', 'funct7', ]; my @flat = Dumper($ref) =~ /'(\w+)/g; print join("\n",@flat),"\n";