in reply to Re: printing lists...
in thread printing lists...
my $first=0; while (<DATA>) { chomp ($_); my $element = $_; if ($first == 0) { $first = 1; # don't print a comma before the first element } else { print ","; # print a comma } print $element; } print "\n"; __DATA__ foo bar blivitz this is a line 1 2 a b cde
Ratazzong produces:
foo ,bar ,blivitz ,this is a line ,1 ,2 ,a ,b ,cde
instead of (what I understand to be) OP's desire:
foo,bar,blivitz,this is a line,1,2,a,b,cde
|
|---|