sub index { #&top_nav; #&weather; #$weatherData = &main; $weatherData = &weather; # $weatherData = weather(); &date; #read in template page for INDEX.HTML####################################### my $templateFileIndex="../htdocs/temp_test/index.html"; open(INFILE,"<$templateFileIndex"); my @templatePageIndex=; close(INFILE); #condense page array into one scalar variable my $tIndex=join("",@templatePageIndex); #search-and-replace variables $tIndex=~s/%%INSERT DATE HERE%%/$liveDate/g; #my $weatherData= &weather; $tIndex=~s/%%WEATHER2%%/$test/g; #tIndex=~s/%%INSERT NAV HERE%%/$navPage/g; $tIndex=~s/%%WEATHER%%/$weatherData/g; #done, output page to browser #Now when this code reads the html file to do the replacements of the variables the $weatherData prints the code from weather.cgi not the result of it, that's the problem. print $tIndex; exit } ############################################################################ sub weather { # read in footer template $foot="cgi-bin/weather/weather.cgi"; open(MYFOOT,"<$foot"); @footerPage=; close(MYFOOT); #condense page array into one scalar variable $weather=join("",@footerPage); $test="test"; return $weather; }