Hi all I'm trying to do the following: Print out the table from an array using HTML teplates.
I'm not sure of the sintax of how to get this table to display, I dont like posting code here, but I'm kinda stuck and I dont know if I am going in the right direction to do what I want to do. my main problem is with this area of the code, and what to supply to it................ if anyone has any good links please let me know. # set up my table, and print it out my $template = q{ <TABLE border=1><TMPL_LOOP name="table_data"> <TR><TMPL_LOOP name="date"> <TD><TMPL_VAR name="time"></TD> </TMPL_LOOP></TR> </TMPL_LOOP></TABLE> }; #take it from the table and put pump it out on to the web $template = HTML::Template->new(scalarref => \$template, option =>'value'); $template->param(table_data => [EMAIL PROTECTED]); Thanks in advance code is below: _________________________________________________________________________________________ #!/usr/bin/perl use strict; use warnings; my $data_file = 'myfile/var/log/my.log'; print "$data_file \n"; # Open the file for reading. open (DATA, "$data_file") or die "can't open $data_file $!"; my @array_of_data = <DATA>; print "this is the file: \n"; #print @array_of_data; print "\n"; #Variable dlecrations my $line; my $testIf; my @date; my @time; my @IVM; my @ID; foreach my $line (@array_of_data) { # Start an if statement, the condition of which is # "If this particular line contains the word dangerous." ######## chomping #print "\n in foreach loop \n"; chomp($line); if ( ($line =~ /TestString/i) && ($line =~ /TestString2/i) ) { ######Changing this to take this as an array (@date, @time, @IVM, @ID) = split (' ', $line); } # End the if condition here. } # End the foreach loop here. close (DATA); ###########################close the file ############################ template section use HTML::Template; # set up my table, and print it out my $template = q{ <TABLE border=1><TMPL_LOOP name="table_data"> <TR><TMPL_LOOP name="date"> <TD><TMPL_VAR name="time"></TD> </TMPL_LOOP></TR> </TMPL_LOOP></TABLE> }; #take it from the table and put pump it out on to the web $template = HTML::Template->new(scalarref => \$template, option =>'value'); $template->param(table_data => [EMAIL PROTECTED]); ##print out html print "Content-Type: text/html\n\n", $template->output;