in reply to Making my Perl program a bit faster

Your question is not only general it is too general. For example a regex can be fast but if you introduce lots of backtracking into it, it can be very slow.

There is a chapter in the official perl book ("Programming Perl" by Larry Wall...) on efficiency (page 537 in my edition), which might have some useful tips for you

I would suggest profiling your program. The "recommended by perlmonks" module of the moment seems to be Devel::NYTProf.

  • Comment on Re: Making my Perl program a bit faster