$str=""; for(my $i=0; $j<100;$i+=1) { for(my $j=0; $j<4;$j+=1) { $str .= "BUCK"."_"."$j"." => "."JUNK".","; } #Removes the Comma at the end $str = substr($str,0,length($str)-1); #Appending flower braces. $str = "{".$str."}"; $xentry[$i] = $str; $str=""; }