subfile('iocommon'); sub subfile { my($f)=@_; my($w); # %GOT_HA seems to be a variable emulating %INC maybe? if(!$GOT_HA{$f}){ # where do $my_base_loc, $subslocation and $ds come from? # is that a case for using File::Spec instead? $f=("$my_base_loc$subslocation$ds$f.sub"); # you need error handling here in case the file is not found: # Are $t and $rep global variables? What are they used for? $t=open (IE,"$f") or die "Couldn't open '$f': $!"; $rep=($t)?'OK':$!; # What does that do? Maybe you want to look in that log for the error report? db("subfile $f",$rep); # Are you using strict; at all? You really should! # This whole section is likely better written as # my $w = do { local $/; }; @tt=; close(IE); while(@tt){ $l=trim(shift @tt); $w.=$l."\n"; } eval($w); if (my $err = $@) { die "Error in evaluating '$f': $!"; }; $GOT_HA{$f}=1; } }