Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by OfficeLinebacker (Chaplain)
on Nov 04, 2006 at 19:25 UTC ( #582264=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 OfficeLinebacker

Observe the difference in effects between $" and $,

$\ = "\n"; my @a = qw( One Two Three ); { local $, = ','; print @a; print "@a"; } { local $" = ','; print @a; print "@a"; }
Output:
One,Two,Three One Two Three OneTwoThree One,Two,Three

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 examining the Monastery: (5)
As of 2021-01-23 13:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?