#!/usr/bin/perl my ($template, $F_H,$file); $file = "file.txt"; if( open $F_H, $file ) { local $/ = undef; $template = <$F_H>; close($F_H); } $template =~ s/\[(\$[\w\[\]\{\}\'\"]*)\]/$1/eeg; print "Content-type: text/plain\n\n"; print $template;