Re: split()'s pattern argument
- From: xhoster@xxxxxxxxx
- Date: 30 Mar 2006 20:44:57 GMT
"Jerry Adair" <jerry.adair@xxxxxxx> wrote:
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( " " );
split " " is a special case, and does not do the same thing as split / /.
A variable which contains a space will give you the split / / behavior, not
the special-case split " " behavior.
This was discussed to death here a couple of weeks ago.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
.
- References:
- split()'s pattern argument
- From: Jerry Adair
- split()'s pattern argument
- Prev by Date: Re: split()'s regex pattern parameter
- Next by Date: Re: Find duplicates in a dat file
- Previous by thread: split()'s pattern argument
- Next by thread: Re: split()'s pattern argument
- Index(es):
Relevant Pages
|