At 13:05 09.07.2001 +0200, [EMAIL PROTECTED] wrote:
>Hi,
>
>I want to remplace all the word "html" in "php" in some web pages ...
>
>I tried this but nothing is happening :
>
>open (TRANS, "c:\\test\\test.txt");
>
>@transformation=<TRANS>;
>
>foreach $ligne (@transformation)
>{
>chomp($ligne);
>$transform=$ligne;
>$transform=~s/html/php/g;
>};
>
>close (TRANS);
You're not doing anything with $transform.
open (TRANS, "c:\\test\\test.txt") || die("Couldn't open
c:\\test\\test.txt: $!"); # added error check
open (OUT, "c:\\test\\test_output.txt") || die("Couldn't open
c:\\test\\test_output.txt: $!");
while(<TRANS>)
{
$_ =~ s/html/php/g;
print OUT $_;
}
close TRANS;
close OUT;
now, you have a new file, test_output.txt, which contains the substituted text
Aaron Craig
Programming
iSoftitler.com