Strip a set of characters from a string: Difference between revisions

Line 489:
</pre>
 
Another good option for stripping characters is to use the <code>tr///</code> operator. This option is very efficient when the set of characters to strip is fixed at compile time, (notebecause <code>tr///</code> is specifically designed for transforming and deleting characters. Note that hyphens also have special meaning in this case):.
<lang perl>$str =~ tr/aei//d;</lang>
 
Anonymous user