use strict; my $fields = ""; # input from web form my $sep = chr(254); # something unique could be '%%%' need to update form my $text = ""; # html document ( could be read from file ) # on return just send to browser my %TWORK = (); # Processed fields from form Template(\$text,\%TWORK,$sep); print qq|Content-type: text/html\r\n\r\n $text \r\n\r\n|; sub Template { my $text = shift; my $hash = shift; my $sep = shift; $$text =~ s{ $sep ( .*? ) $sep } { exists( $hash->{$1} ) ? $hash->{$1} : "" }gsex; }