# Give largesub and its entourage their own module package ModuleWithLargeSub; sub smallsub { ...process... } sub largesub { my ($e, $f, $g, $h) = @_; my $foo = &smallsub($e); ...process... return \@AoH; } 1; # Then in the cgi script: #!/usr/bin/perl use strict; my $run_large_sub; ...etc... ...initiate variables... ...HTML::Template setup... my $AoH; if($run_large_sub) { require ModuleWithLargeSub; $AoH = ModuleWithLargeSub::largesub($a, $b, $c, $d); } $template -> param( todisplay => $AoH ); print $template->output(); exit();