From: "Gary Hawkins" <ghawk@eskimo.com> > 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 =========== Jenda@Krynicky.cz == 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. --- meThread Previous | Thread Next