Hi Folks,
I have an html file which contains the below line in the body tagI am trying the replace hello with Hello Giridhar programatically.
<body>
<P><STRONG><FONT face="comic sans ms,cursive,sans-serif"><EM>Hello</EM></FONT></STRONG></P>
</body>
I have written the below code to replace the string and I am able to print it but how to replace the string(Hello Giridhar) in the html file.
Please correct the code where you think I made the mistakes.
my $filename = "theme1.htm";
my $old = "Hello";
my $new = "Giridhar";
$new = "$old ".$new;
open(my $fh, '<', $file_name) || die "file could not open $! \n";
while( $line = <$fh>)
{
if( $line =~ s/$old/$new/g )
{
print "$line\n";
}
}
close($fh);
Thanks in advance...