Perl / File Manipulation / Templates
Snippet details
ID: 511
Viewed: 1361
Added: 2003-09-30
Version: unknown
A simple function to read html file find a tag and replace it with custom html code...
General Details
Snippet uploaded by: Lee Trussell
Email : lee.trussell@ntlworld.com
Snippet By: Lee Trussell
<!---Head--->
none
<!---Body--->
sub file_rep
{
my ($replace,$replacement,$html) = @_;
#be carful about cgi security if parsing value
$html =~ s/$replace/$replacement/;
return $html;
}
my $html;
open(file,"C:\windows\deskop\files.html") || die("This file will not open");
$html .= $_ while(<file>);
close(file);
$html = &file_rep("<!--tag-->","<b>bold text</b>",$html);
print "Content-type: text/htmlnn";
print $html;
No Reviews to show
