#!/usr/bin/perl use strict; ...etc... ...initiate variables... ...HTML::Template setup... my $AoH = &largesub($a, $b, $c, $d) if $run_large_sub; $template -> param( todisplay => $AoH ); print $template->output(); exit(); sub largesub { my ($e, $f, $g, $h) = @_; my $foo = &smallsub($e); ...process... return \@AoH; } sub smallsub { ...process... }