daverave has asked for the wisdom of the Perl Monks concerning the following question:
I have a simple, general question regarding a real small issue that bothers me:
I'm printing a list of elements on the fly, so I don't have prior knowledge about the number of printed elements. I want a simple format where the elements are separated by a comma (elem1, elem2...) or something similar. Now, if I use a simple loop like:
I get a comma after the last element...while(elements to check) { if (elem should be printed) { print elem . "," } }
I know this sounds quite stupid, but is there a way to handle this?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: printing lists...
by Ratazong (Monsignor) on Jul 27, 2010 at 10:39 UTC | |
by ww (Archbishop) on Jul 27, 2010 at 11:54 UTC | |
|
Re: printing lists...
by cdarke (Prior) on Jul 27, 2010 at 12:01 UTC | |
|
Re: printing lists...
by johngg (Canon) on Jul 27, 2010 at 13:09 UTC | |
|
Re: printing lists...
by Anonymous Monk on Jul 27, 2010 at 10:24 UTC |