my $zip = $zip_server->get_zip_codes(); print "selectbox-header"; for (@$zip) { print "selectbox line"; } print "selectbox-end"; #### ...in common initialisation code... our $zip; $zip=$zip_server->get_zip_codes(); ...where the zip-code is needed... print "selectbox-header"; for (@$zip) { print "selectbox line"; } print "selectbox-end" #### ...in the common initialisation code... our $zip; sub zip_init { $zip = $zip_server->get_zip_codes() unless $zip; } ...at every use... zip_init(); print "selectbox-header"; for (@$zip) { print "selectbox line"; } print "selectbox-end"; #### ...in initialisation section... our $zip; tie $zip .... # magic here sub ZIP::TIE::FETCH { # smoke and mirrors here $zip = $zip_server->get_zip_codes(); untie $zip; # and leave the data in $zip } ..and where we use it... print "selectbox-header"; for (@$zip) { print "selectbox line"; } print "selectbox-end";