#!/usr/bin/perl -T use strict; use warnings; use CGI qw(:standard); my @name = qw( author distributor copyright abstract keywords description distribution robots language rating ); print header, start_html('Meta Tag Generator'), start_form, table( # i know maps are scarey, just think of this as a # backwards for loop (read bottom up) map { Tr( td(ucfirst $_ . ': '), td(textfield(-name=>$_,-size=>40)), ) } @name ), submit('submit'), end_form, ; if (param('submit')) { for (@name) { # this is how you trim down fetching params code ;) my $param = param($_); # this skips empty fields, you might want to err instead next unless $param; # notice the use of meta() as well as escapeHTML() # since we have alread loaded CGI.pm, let's use it! print escapeHTML(meta{name=>$_,content=>$param}),br; } } print end_html;