$var1 = q("one","two","three",'four'); for $var2 ( split(/,/, $var1) ) { $var2 =~ s/"|'//g; push(@arr1, $var2); } print "@arr1\n"; one two three four