sub tmpl { my $usrid = get_my_userid(); my $text; local $/; local *D; my ($dat, $hashref) = @_; open(D, $_[0]) || die $!; $text = ; close(D); $hashref->{sid} = $sessionid unless $hashref->{sid}; $hashref->{username} = $usrid; chop($text); $text =~ s{ %% ( .*? ) %% } { exists( $hashref->{$1} ) ? $hashref->{$1} : "" }gsex; print header(-type => "text/html", -charset => 'ISO-8859-1') if $hashref->{header} == 1; return $text; }