On Tue, 22 Mar 2005, Offer Kaye wrote:

> On Mon, 21 Mar 2005 12:53:36 -0800, John W. Krahn wrote:
> 
> > $string =~ tr/\x80-\xFF//d;
> 
> Very nice solution! Here's a variation, using the "s///" operator: 
> $string =~ s/[\x80-\xFF]//g;

If you benchmark it, I suspect the tr/// version will be much faster.

It's a simpler operation than s///, so if you can get away with using a 
translation instead of a substitution, you should get a speed boost.
In a lot of cases, the tr/// is *too* simple, and you're stuck. But in 
this example, it works, and should do well.

As always though, the only way to be positive is to measure it :-)
 

-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to