develooper Front page | perl.beginners | Postings from February 2002

Crop string to x characters

Thread Previous | Thread Next
From:
Gary Hawkins
Date:
February 17, 2002 14:34
Subject:
Crop string to x characters
Message ID:
LOBBIJFNBAGIOILLFAIBAEFDNJAA.ghawk@eskimo.com
How do I truncate a string to a particular number of characters?

This is expensive:

$shortdescription =~
s/(............................................................................
........................................ ).*/$1/;

Gary



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About