split()'s regex pattern parameter
- From: "Jerry Adair" <jerry.adair@xxxxxxx>
- Date: Thu, 30 Mar 2006 14:27:28 -0500
Hello-
'Encountering something weird (well weird to me), 'couldn't find it in the
FAQ:
when attempting to call split() with a value to "split on" that is stored in
a scalar, I get behavior other than what I expected. The Camel book says to
just put it inside match delimiters, but that doesn't help the cause. Thus:
@line = split( /$separator/ );
doesn't do what I thought it would, as if $separator was replaced with:
@line = split( " " );
The problem I am encountering is when I try to access the list produced by
the split (with the scalar), the first list value is null. However, with
the simple string example (I know that split will parse a string as a
pattern even when not given as a pattern) I get the correct results, which
is a non-null list (for a given non-null line of data).
I don't know why this pattern won't work in regex parser, I was surprised.
I'm probably missing something simple, but I thought I'd ask anyway.
Thank you in advance.
Jerry
.
- Follow-Ups:
- Re: split()'s regex pattern parameter
- From: Dr.Ruud
- Re: split()'s regex pattern parameter
- From: Paul Lalli
- Re: split()'s regex pattern parameter
- Prev by Date: Re: Converting codepages to UTF8
- Next by Date: split()'s pattern argument
- Previous by thread: Windows Hooking
- Next by thread: Re: split()'s regex pattern parameter
- Index(es):
Relevant Pages
|