#!/usr/bin/perl -Tw use strict; use CGI qw(:standard); use Date::Calc qw/Month_to_Text/; use Template; my $employee=param('employee_name') || ''; my $filename = "Files/$employee.txt"; open(JOE, "$filename") or die "Couldn't read '$filename': $!"; my @data = ; close (JOE); my @certs; while(@data){ my %h; @h{ qw/certification month day year/ } = map {chomp; $_} splice(@data,0,4); $h{monthStr} = Month_to_Text($h{month}); push @certs, \%h; } my $data = { employee => $employee, certs => \@certs, }; my $template = Template->new(); print header; # use Data::Dumper; # Use this for debugging # print "
".Dumper($data)."
"; # to see what $data is. $template->process(\*DATA, $data) or die $template->error(); exit; __DATA__ Employee Certifications Employee's name is [% employee %]


[% FOREACH row = certs %] Certification is [% row.certification %] on [% row.monthStr %] [% row.day %] [% row.year %]


[% END %]
To go Back
Click Here