sub index { #&top_nav; &weather; #$weatherData = weather(); #$weatherData = &weather(); #$weatherData = &weather; #$weatherData = main(); &date; #read in template page for INDEX.HTML####################################### my $templateFileIndex="../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 on date, nav bar and variables $tIndex=~s/%%INSERT DATE HERE%%/$liveDate/g; #my $weatherData= &weather; $tIndex=~s/%%WEATHER2%%/$test/g;#This one works jus fine I can make the substitution. #It doesn't work #$tIndex=~s/%%WEATHER%%/$weatherData2/g; #$tIndex=~s/%%WEATHER%%/$weatherData/g; #$tIndex=~s/%%WEATHER%%/&weather/g; #$tIndex=~s/%%WEATHER%%/$weather/g; #done, output page to browser print $tIndex; exit } ############################################################################ sub weather { # read in footer template $foot="c:/progra~1/apache~1/apache/cgi-bin/weather/weather.pl"; #This program print a weather forecast into html page template open(MYFOOT,"<$foot"); @footerPage=; close(MYFOOT); #condense page array into one scalar variable $weather=join("",@footerPage); $test="Test variable, passing value to html template"; return $weather; }