On Friday, August 10, 2001, at 04:30 , Newton, Philip wrote:

> Michel Lambert wrote:
>> 1) What's the fastest way to strip trailing whitespace ( as
>> defined by /\s/ ) from a decent-sized string? Decent-sized
>> means this email, or 100 of these emails concatenated together.
>
> I would imagine
>
>     $string =~ /\s+\z/;
>
> ?

What about

        $string = reverse $string;
        $string =~ s/^\s+//;
        $string = reverse $string;

I haven't had any coffee yet this morning, so I'm probably 
missing a way to condense that. Time to break out 
Benchmark.pm....

--
Craig S. Cottingham
[EMAIL PROTECTED]
PGP key available from: 
<http://pgp.ai.mit.edu:11371/pks/lookup?op=get&search=0xA2FFBE41>
ID=0xA2FFBE41, fingerprint=6AA8 2E28 2404 8A95 B8FC 7EFC 136F 
0CEF A2FF BE41

Reply via email to