[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



or

> $buffer =~ s/[\000-\011\013\014\016-\037\177-\377]//g;

Just to be different, you could use "tr":

   $buffer =~ tr/[ -~\n\r]//cd;

The "c" complements the search list and the "d" says to delete matched 
characters without a replacement listed (there are no replacements in 
this example). Unless $buffer is "large," it won't matter, but using 
tr/// is faster than s/// (see "Programming Perl", 2nd ed., p. 541).

S

-- 
Stephen Cristol
cristol at emory.edu



</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00179" href="msg00179.html">[ale] Stripping out crap characters  in perl</a></strong>
<ul><li><em>From:</em> Keith.Watson at gtri.gatech.edu (Keith.Watson at gtri.gatech.edu)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00183.html">[ale] Colo NE Metro Atlanta?</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00185.html">[ale] SUSE 9.2 dialup</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00179.html">[ale] Stripping out crap characters  in perl</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00173.html">[ale] linux generalist needed</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00184"><strong>Date</strong></a></li>
<li><a href="threads.html#00184"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>