Hello,

I am teaching myself perl. I have become stuck. My script is designed to
write, read and display log files. I am having a hard time getting the
correct data from the log file to a template file. My code will match the
correct lines in the log file but when I pass it to the template it displays
the first line matched each iteration of the HTML::Template loop. I am not
sure if it is an error in the way I construct the data or an error in how I
passing to the template.

Here is the code

[.. snip..]

if ($view eq "detail") {
  open (LOG, $log_file) or die ("Couldn't open log file -  $log_file -
$!\n");
  while (<LOG>) {
  chomp;
  @line = split(/\|/, $_);
  $shortDate = substr($line[0], 0, 8);
  if($shortDate eq $selectedDate) {
  push (@displayDate, $line[0]);
  push (@pageViewed, $line[1]);
  push (@ip, $line[2]);
  push (@remoteAddy, $line[3]);
  push (@userAgeant, $line[4]);
  push (@referer, $line[5]);
} else { next }
$rowData{displayDate} = shift @displayDate;
$rowData{pageViewed} = shift @pageViewed;
$rowData{ip} = shift @ip;
$rowData{remoteAddy} = shift @remoteAddy;
$rowData{userAgeant} = shift @userAgeant;
$rowData{referer} = shift @referer;
push(@display, \%rowData);

}
close (LOG) or die ("Couldn't close log file -  $log_file - $!\n");

$template->param(DETAIL_DATA => \@display);

[..snip..]

Also, as I am very new to perl I would be grateful for any general tips.

Thanks in advance!


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to