In the Python world it is quite straight forward to make files work either as executables or as modules. In Perl it is a bit strange, but doable.

brian d foy has written a number of articles about Modulinos, but in nutshell a Modulino is a Perl file that can act both as an executable (a script that you would invoke directly) or as a module (Something you load into memory and expect to execute code only when you call one of its functions or methods).