# Create a module with the subroutine(s) you want to share package MyLibrary; sub func_1 { ... } # ------------------------------------------------- 42 # non-zero indicates successful loading of module # ------------------------------------------------- # then in your cgi script: use lib '.'; use MyLibrary; print MyLibrary::func_1( @args );