On 4/21/09 Tue Apr 21, 2009 11:54 AM, "Grant" <emailgr...@gmail.com> scribbled:
>> 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)); If there are no spaces in the first 35 characters of $string, then $var = $string. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/