snippet library logo
Amazon.com
in category
Perl / File Manipulation / Templates
Snippet details
ID: 511
Viewed: 1361
Added: 2003-09-30
Version: unknown

User Rated at:
Rate This:
Snippets in this catagory         
Show Printable Version
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


Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Subject:

Reviewed By:

Write a review:





Terms of Conditions
Powered By
Avian Hosting
© 2005 snippetlibrary.com All Rights Reserved.