use Benchmark; my $start1 = Benchmark->new(); ##Code you want to profile my $end1 = Benchmark->new(); my $diff1 = timediff($end1, $start1); print "Section 1: ", timestr($diff1); my $start2 = Benchmark->new(); ##Next section of code you want to profile my $end2 = Benchmark->new(); my $diff2 = timediff($end2, $start2); print "Section 2: ", timestr($diff2);