On Wed, 02 Feb 2005 20:37:54 +0000, mike <[EMAIL PROTECTED]> wrote: > No the problem was that this ( with the quote in the "right" place) was > giving me what I didnt want. > > this is the code > @value=param(); > shift (@value); > shift (@value); > pop (@value); > print @value; > foreach $value (@value){ > $value1=substr($value,0,9); > if ($value1 eq "work_emai"){ > push (@value2,param($value)); > push (@value2,"\t"); > #print $value2; > } > else { > push (@value2,param($value)); > push (@value2,'##'); > #print param($value) > } > } > $value4=join('',@value2); > print br,"value4",$value4,br; > @array3=split(/\t/,$value4); > @[EMAIL PROTECTED]; > > with "\t" the \t was being inserted into a db field, without it > everything was hunky dory
You asked, though, if adding quotes changed the behavior of split. It does not. What you did was change the regex. Adding the quotes didn't mean that split suddenly kept the final delimeter, it meant that you were no longer splitting on what you thought you were splitting on /\t"/ looks for a \t and then a ". Splitting on /\t/ looks of a \t. Since join only inserts delimeters between items and not after the final item, your final value ended with \t instead of \t"; split didn't know it was a delimeter. You'll notice the way you're doing things now, all the values joined by join, except the first, still have a " at the beginning. Split behaves exactly as predicted in both cases: it removes exactly and only what you ask it to. What you're really looking for is probably: $value4 =~ s/\t$//; @array3 = split(/\t"/, $value4); 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>