On Wed, 02 Feb 2005 12:39:17 +0000, mike <[EMAIL PROTECTED]> wrote:
> Am I right in thinking that if you double quote the seperator in split
> the seperator is added to the array ie:
> 
> @array3=split(/"\t/",$value4); would add \t to the end of @array3 while
> 
> @array3=split(/\t/,$value4); would not
> 

I think we need a little more information here, maybe a sample value
for $value4.  Split, though, doesn't add anything; it removes the
delimiter.  If you have:

     $value4 = "one\ttwo\tthree\tfour\tfive" ;

     @array3=split(/\t/, $value4) ;

returns @array3 = ["one", "two", "three", "four", "five"]

The delimiter is never included in the returned data.  If you
questions is really "what happens when there is a trailing delimiter,
or an empty field in the data?", the answer is, trailing delimiters
are ignored, otherwise empty strings are returned.  So if

     $value4 = "\tone\t\ttwo\tthree\t\tfour\tfive\t" ;

then

     @array3 = ["", "one", "", "two", "three", "", "four", "five"]

If you need some other behavior, you need to constuct a more complex
regex for split, but simple adding quotes doesn't change the behavior.

HTH,

--jay

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


Reply via email to