in reply to Difference between tr/// and s///?
In addition to what others have noted, here is a simple rule on when to use tr/// or s///: if you can get away with using tr///, do it. tr/// doesn't even startup the regex engine, so it's pretty fast (see above). The price you pay is flexibility, so don't spend too much time trying to nail a square tr/// solution into a round s/// problem.
----
I wanted to explore how Perl's closures can be
manipulated, and ended up creating an object
system by accident. -- Schemer
: () { :|:& };:
Note: All code is untested, unless otherwise stated
|
|---|