How can I output a list as comma-separated values in Perl?

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-05-21T15:48:02Z Indexed on 2010/05/22 15:50 UTC
Read the original article Hit count: 154

Filed under:
|

Let's say I have a list of elements

@list=(1,2,3);
#desired output
1,2,3

and I want to print them as comma separated values. Most importantly, I do not want the last element to have a comma after it.

What is the cleanest way to do this in Perl?

© Stack Overflow or respective owner

Related posts about perl

Related posts about text-formatting