The absolute best way to profile Perl code is to use Devel::NYTProf.
Step 1. Install it, because it’s not part of the standard distribution (it should be). It’s called Devel:NYTProf, and is in ActiveState’s ppm as well as the more standard cpan.
Step 2. Use it
perl -d:NYTProf <command line to run your program> nytprofhtml --open
This will give you a nice HTML-based profile of the execution of your program. Among the notable features are a treemap and a number of ways to drill down into the hotspots. It will even generate DOT files for rendering in Graphviz, although these are not always useful.
The perldoc on CPAN is here: Devel::NYTProf.
I’ll put a real profile up soon of one of my programs, but for now here’s an example of one that I found in a Google search: C:/lo/libo-master/solenv/bin/make_installer.pl