From: "Gary Hawkins" <[EMAIL PROTECTED]>
> How do I truncate a string to a particular number of characters? > > This is expensive: > > $shortdescription =~ > s/(................................................................... > ......... ........................................ ).*/$1/; > > Gary If you insisted on using regexps you could use $shortdescription =~ s/^.{50}.*$/$1/; But it would be quicker to use substr() $shortdescription = substr $shortdescription, 0, 50; Jenda =========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ========== There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]