Apr 22, 2002, 12:01 AM
Post #5 of 5
both work fine is not a proper answer in my book. do you understand how they are different and why you should choose
Re: [benchivers] Deleting Spaces in variables
[In reply to]
one over the other? many perl newbies learn s/// and neglect to learn tr///. and many others conflate the two just because the both can use the bind =~ operator. but if you are munging characters and not strings, then tr/// is likely to be faster and a better semantic match to the problem.
that last point bears repeating. code is NOT meant to get some program working but to express the solution to another coder. if code were just meant for computers, we would all use the same language. different languages and constructs map better onto certain problems and brains. the human aspect of code is much more important than the computer aspect. when you learn that, you become a much better coder.
in short, code is for people, not computers.