Dave and William,

Dave,yes - but the idea is that this is a variable
that I actually have set in a config file... I need a
solution that allows for any delimiter put there -- it
may need to change depending on the solution
parameters...

Anyway -- William's suggestions for both quotemeta and
using \Q and \E seem to be what will work for me.

Thanks all,

John

--- David Craig <[EMAIL PROTECTED]> wrote:

> John, how about:
> 
> (@fields) = split /(\||\^)/,$record;
> 
> 
> I know it looks like line noise, that's a pipe
> (escaped) a pipe (as the 
> logical OR) and a caret (escaped)
> 
> Pipe and caret have special meanings in regex, so
> they have to be 
> handled specially.
> 
> 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?
> > 
> > Thanks,
> > 
> > John
> > 
> > 
> > 
> > 
> > =====
> > John V. Pataki
> > Logged in to my Yahoo Mail account on the web.
> > 
> > _______________________________________________
> > ActivePerl mailing list
> > [EMAIL PROTECTED]
> > To unsubscribe:
> http://listserv.ActiveState.com/mailman/mysubs
> > 
> > 
> _______________________________________________
> ActivePerl mailing list
> [EMAIL PROTECTED]
> To unsubscribe:
> http://listserv.ActiveState.com/mailman/mysubs
> 


=====
John V. Pataki
Logged in to my Yahoo Mail account on the web.

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

Reply via email to