#!/usr/bin/perl -w use CGI qw/ fatalsToBrowser/; # don't do this in production use strict; require "myfile.pl"; &foo(); # &foo is defined in myfile.pl #### . . . #much handwaving exec($0); . . . #### : : # NOTE: $q was defined elsewhere as my $q=new CGI; print $q->redirect("http://my.site.tld/cgi-bin/foo.cgi?...") : : :