Offer Kaye wrote:
On Mon, 21 Mar 2005 12:53:36 -0800, John W. Krahn wrote:

$string =~ tr/\x80-\xFF//d;

<joke> No no, he can't use that - that solution is much too elegant! It will also quite probably run faster than my suggested solution! </joke>

Very nice solution! Here's a variation, using the "s///" operator:
$string =~ s/[\x80-\xFF]//g;

Well, s/he did say s/he wanted a regex so I originally thought s/[^[:ascii:]]+//g but then s/he asked for "a efficient way" so I had to go with transliteration. :-)


John -- use Perl; program fulfillment

--
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