Easy way to print Perl array? (with a little formatting)

后端 未结 11 726
猫巷女王i
猫巷女王i 2021-01-30 10:13

Is there an easy way to print out a Perl array with commas in between each element?

Writing a for loop to do it is pretty easy but not quite elegant....

11条回答
  •  面向向阳花
    2021-01-30 10:31

    Map can also be used, but sometimes hard to read when you have lots of things going on.

    map{ print "element $_\n" }   @array; 
    

提交回复
热议问题