There's a comma in the example data provided.  Most of the CSV's I've
dealt with also quote values which were strings.  If this is the case,
an ugly solution would be to use something along the lines of '","' as
the delimiter, take into account any possible fields which aren't quoted
(it should be entire fields and not record specific) and then retrieve
the proper index.  You'd be much better off using regex or a CSV module
however. 

yitzle wrote:
> On 10/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>   
>> One of the column in csv file is Fri, Oct 12 10:32 AM. I am trying ti split 
>> the csv file for checking a column value. when spliting I wanted to take 
>> Fri, Oct 12 10:32 AM as a single value. How can I use split?
>>
>> Thanks
>> Manoj
>>     
>
> If the CVS uses a comma, you would split on the comma:
> split /:/, $line;
>
> As Tom said, if you only want the, say, 4rd field, you can use a RegEx:
> $value = $1 if ( $line =~ /^(?:[^,]*,){3}([^,]*),/ );
>
> Unfortunately, this gets messed up if a comma is anywhere present in
> any of the fields, or if a field is more than one line (though I have
> no idea if that's possible).
>
> There is a CVS module you may want to search for on CPAN.
>
>   


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to