RE: another easy question (actually 3)

2002-01-03 Thread Curtis Poe
--- [EMAIL PROTECTED] wrote: > > Curtis, > > I couldn't find this module in my standard PERL lib path. I guess I > should get this from cpan.org. Right? > > [sathish] Yes. You can get it from the mirror http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?dist=Text-CSV_XS-0.23 Note that this i

RE: another easy question (actually 3)

2002-01-03 Thread Booher Timothy B 1stLt AFRL/MNAC
I can't get your implementation to work . . . What about s/^\s+|\s+$//g ? shouldn't it be s/(^\s+)|(\s+$)//g ? And why the if in: $_ = "\"$_\"" if ( $_ =~ /[,"]/ ); aren't you trying to keep that trailing comma off - I don't see where you add the comma. Tim __

RE: another easy question (actually 3)

2002-01-03 Thread SathishDuraisamy
Timothy, I'd use a proper module for something like this. CSV data can get tricky, so see if you can install Text::CSV_XS. Here's some sample code: use strict; use Text::CSV_XS; > Curtis, > I couldn't find this module in my standard PERL lib path. I guess I should get this from c

Re: another easy question (actually 3)

2002-01-03 Thread Curtis Poe
--- Booher Timothy B 1stLt AFRL/MNAC <[EMAIL PROTECTED]> wrote: > o.k. here is another one: > > I still have a text file I am trying to get into a csv line, for example: > > cheese olives beans carrots > > So I put this into an array like: > > my @heade

RE: another easy question (actually 3)

2002-01-03 Thread SathishDuraisamy
But now I want to print this in csv format: "cheese","olives","beans","carrots". > Be careful. The CSV formated line can get trickier if it > already contains a comma or a double-quote. For example, > the line > chee,se oli"ves beans carrots > should be translated to > "chee,se","oli""ves",b

RE: another easy question (actually 3)

2002-01-03 Thread SathishDuraisamy
I find that I get a zero-length field for $headers[0] and don't understand why. Trim the leading and trailing spaces, like this: s/^\s+|\s+$//g; Lastly, does /\s+/ mean 2 or more spaces or does it mean one or more spaces, '+' "means one or more"; '*' means "zero or more"; They are post-fix.

another easy question (actually 3)

2002-01-03 Thread Booher Timothy B 1stLt AFRL/MNAC
o.k. here is another one: I still have a text file I am trying to get into a csv line, for example: cheese olives beans carrots So I put this into an array like: my @headers = split /\s+/; But now I want to print this in csv format: "cheese","olives","