Input data looks like:
Broken,Heart,36,20,05,05/03/2000,F,6,5,4,5,5,8,5,5,5,48,06,12,01,,,

I am expecting:
Field 1 = Broken
Field 2 = Heart
Field 3 = 36
Field 4 = 20
Field 5 = 05
Field 6 = 05/03/2000
Field 20 = ""
Field 21 = ""
Field 22 = ""
----Original Message Follows----
From: Curtis Poe <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: CGI Beginners <[EMAIL PROTECTED]>
Subject: Re: split function question
Date: Thu, 28 Jun 2001 12:55:20 -0700 (PDT)

--- Brian Bukeavich <[EMAIL PROTECTED]> wrote:
 > I need a little help with the split function. I'm trying to split a line
 > based on comma delimeters(,), but when I use the syntax below I don't get
 > the results I expect.  What am I doing wrong?  Is there a an special 
escape
 > sequence for a comma?
 >
 > my @asLine = split (/,/, $_);

Just a quick guess, but much of the comma-delimited data that I see has 
quoted fields that have
commas embedded in the quotes:

   "Poe, Curtis", 34, "Aspiring Screenwriter, Programmer"

Trying to split the above line on commas will result in five fields instead 
of three.  You should
probably use a module like Text::CSV or something similar.

If you show us some sample input, expected output, and actual output, we can 
offer better advice.

Cheers,
Curtis Poe

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

Reply via email to