use strict; my $test="[a,b],c,'d',[e,[f,g,h,[i,j],k,l],m,n],o,p"; $test =~ s/([a-zA-Z])/"$1"/g; my @array = eval ( $test );