Tip 1 Tip 2 Tip 3 #### Tip of the Week Current Tip:

Archived Tips:

##
## #!/usr/bin/perl -w use strict; use HTML::Template; my $template = HTML::Template->new(filename => 'tipDisplay.tmpl'); print "Content-type: text/html\n\n"; my @tipList; open (IFS, "tips.txt"); # Put all of the tips into an array on hash references while () { push @tipList, { 'Tip' => $_ }; } close IFS; # Take the most recent tip out of the array my $tempHashRef = pop @tipList; my %tempHash = %{$tempHashRef}; my $recentTip = $tempHash{'Tip'}; # Supply the template with data $template->param( Archive => \@tipList, ArchiveExists => @tipList, RecentTip => $recentTip, ); print $template->output; #### print "Raw Data

"; foreach (@tipList) { my %hash = %{$_}; print "Array Item: $_ = $hash{'Tip'}
"; } my $numItems = @tipList; print "ArchiveExists: $numItems
"; print "recentTip: $recentTip
"; ##
## Raw Data Array Item: HASH(0x81a3da8) = Tip 1 Array Item: HASH(0x81a694c) = Tip 2 ArchiveExists: 2 recentTip: Tip 3