标签: string perl
我可以使用此声明重复一个字符串
print "(","arr[0],"x35,")";
打印(arr[0],arr[0],...,arr[0],)
(arr[0],arr[0],...,arr[0],)
但如何获得如下输出
(arr[0],arr[1],...,arr[34])
即;每次打印字符串时,它应该用0,1,2,..,34
答案 0 :(得分:5)
print '(', join(',', map { "arr[$_]" } 0..34), ')', "\n";