...prog....(main)....(statements in package main here).. use strict; use Readonly; ...then a package definition in middle of prog.... package my_temp_convert; our $VERSION = '.01'; require Exporter; our @ISA = ('Exporter'); our @EXPORT = qw(set_temp, set_scale, c, f); my curr_scale=0; #centigrade, 1=faren my cur_ctemp=0; sub set_scale{ curr_scale=shift} sub set_temp($){#convert to C if needed, and store in "curtmp"} sub c {return cur_temp;} sub f {return 32+(9*cur_temp)/5} #now back to main.... package main; # somehow "use the above, inline package, "temp_convert"; set_scale(1); set_temp(32); print "%d F is %d C\n", f(), c(); #prints "32 F is 0 C" #end prog