Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Answer: How do I print an array with commas separating each element?

by ar0n (Priest)
on Aug 30, 2000 at 15:13 UTC ( #30281=categorized answer: print w/replies, xml ) Need Help??

Q&A > arrays > How do I print an array with commas separating each element? - Answer contributed by ar0n

$, = ','; print @array;

$, 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

local $, = ',';

Replies are listed 'Best First'.
RE: Answer: Is there a quick way to print an array with commas seperation each element?
by davorg (Chancellor) on Aug 30, 2000 at 18:42 UTC
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2021-01-21 22:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?