>>> if you have in $string = q[1234 12345 12 5346 12367 123 123678123];
>>> Then $var1 will be '1234 12345 12 5346 12367 123 12367', but I thought you
>>> wanted '1234 12345 12 5346 12367 123'?
>>> Which one is the right one for what you are doing?
>>
>> You're right, I would want:
>>
>> 1234 12345 12 5346 12367 123
>>
>> Can you show me how to do that properly?
>
> $var1 = substr($string,0,rindex($string,' ',35));

That seems to work great.  I did some experimentation with $var2 but
couldn't get it to behave properly.  I need something like this:

$var2 = substr($secondstring,0,rindex($string,' ',26));

but I need $secondstring to refer to the removed portion of $string.

In case anyone's curious, this is to fit Google's AdWords requirements
for ad text.  I'm working with the Google::Adwords CPAN module.

> If there are no spaces in the first 35 characters of $string, then $var =
> $string.

Just so I'm clear, $var1 = $string in that case right?

- Grant

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to