in reply to using modules

All other things being equal; a lot of code will probably be slower than a little bit of code. Perl needs to load the code off the disk, and compile it into its in-memory representation (the so called "op tree") - and more code takes longer to load and compile.

However a fast algorithm that uses a lot of code will run faster than a slow algorithm written in a small amount of code. And for most non-trivial scripts, run time is more of a significant factor than compile time. A good module written by someone who knows about the topic at hand, and is aware of optimization techniques may well run faster than the code you'd write yourself.

package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name