Q&A > arrays
Answer: How do I print an array with commas separating each element? contributed by Jouke There is:
|
Answer: How do I print an array with commas separating each element? contributed by ar0n
$, is the output field separator: print will insert whatever string has been assigned to $, between all of its arguments. Note that if you use this technique, you should make your assignment to $, temporary by doing
|
Answer: How do I print an array with commas separating each element? contributed by OfficeLinebacker Observe the difference in effects between $" and $, — Output:
|
Answer: How do I print an array with commas separating each element? contributed by Roy Johnson $" can also be used for this:
|
Answer: How do I print an array with commas separating each element? contributed by nite_man And another way:
|
Answer: How do I print an array with commas separating each element? contributed by Coruscate For completeness, here's a verbose solution:
|
Answer: How do I print an array with commas separating each element? contributed by turnstep Here's another way:
It puts a newline instead of a comma after the last element. |
Please (register and) log in if you wish to add an answer
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |