If you'll forgive some general remarks only tangentially related to your question -- to add to what tye said, they say that premature optimization is the root of all evil. I think it's generally better to write a program in the way that most clearly and naturally expresses what you want it to do, that's most maintainable and so on; optimize only when it's necessary and worthwhile, and then profile to see where the hotspots are and focus on those, not on what looks most ripe for optimization. And always: measure, measure, measure.
Disclaimer: I'm not a programmer or in fact any kind of IT pro, I just occasionally use Perl because it helps me solve problems.