in reply to Profiling Perl Code

Is there a module I could use to perform the profiling?

Yup. Take a look at Devel::SmallProf.