John V. Pataki wrote:
> I use a variable for a field delimiter when reading
> CSV files... I have been wrestling with the best way
> to code my split regex so that it works with all
> possible values of that variable.
> 
> It is currently failing when I set the value of the
> variable to ^
> 
> 
> # if delimiter is | - this syntax works fine
> 
> $del=|
> (@fields) = split /[$del]/,$record;
> 
> 
> # if delimiter is ^ - this syntax fails - no split
> $del=^
> (@fields) = split /[$del]/,$record;
> 
> 
> What syntax will work for both (all) cases?

According to its documentation Text::CSV_XS allows you to configure the
separator character, among other things.

HTH

-- 
Brian Raven
 


-----------------------------------------------------------------------
The information contained in this e-mail is confidential and solely 
for the intended addressee(s). Unauthorised reproduction, disclosure, 
modification, and/or distribution of this email may be unlawful. If you 
have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message 
do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary 
companies.
-----------------------------------------------------------------------


_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to