Hi dear Jeff: Thank you very much for your help
Yiur script is working flawlessly Just another question: How could I re-write your script in order to treat the __DATA__ portion of your code as an external file ? I happen to have the whole CSV file and I would not want to mix directly with it, but to reference it from the perl code How could I accomplish that ? Should I substitue the <DATA> for the name of the CSV file in the perl code ? Thank you very much for any help Regards Erasmo On 26/06/2008, Jeff Peng <[EMAIL PROTECTED]> wrote: > On Fri, Jun 27, 2008 at 12:26 AM, Erasmo Perez <[EMAIL PROTECTED]> > wrote: > >> >> a,b,.,.,.,.,.,.,. >> b,c,d,.,.,.,.,.,. >> e,f,g,h,.,.,.,.,. >> i,j,k,l,m,.,.,.,. >> >> and so on >> >> My problem: how could I get rid of the trailing points and commas, so >> the output CSV file could get following neat format (without the >> trailing points and its commas separators): >> >> a,b >> b,c,d >> e,f,g,h >> i,j,k,l,m >> > > Hello, > > Follow your sample data, you may try: > > use strict; > > while(<DATA>) { > s/(\,\.)+$//; > print; > } > > __DATA__ > a,b,.,.,.,.,.,.,. > b,c,d,.,.,.,.,.,. > e,f,g,h,.,.,.,.,. > i,j,k,l,m,.,.,.,. > > > The output is: > > a,b > b,c,d > e,f,g,h > i,j,k,l,m > > -- > Jeff Peng - [EMAIL PROTECTED] > http://home.arcor.de/mailerstar/jeff > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/