http://www.perlmonks.org?node_id=1061046


in reply to Performance improvement by using $_ instead of named variables

To quote from a little book with a lot of punch, The Elements of Programming Style, by Kernighan & Plauger:

Don’t “diddle” your code to make it faster.   Find a better algorithm.

If a program “that does a large amount of text manipulation” is taking a long time to complete, it is most-likely using too much memory.   (For example, are you “slurping” all of the file content into an array?)   It could be using an algorithm that is inefficient in some other way ... and, yes, that could include “copying” values unnecessarily.   Profiling should be the first step of showing you where the “hot spots” are.   Playing monkey-games with variable names, ultimately, will do nothing to speed-up your cod, but a great deal more to introduce bugs into it.