im trying to make a censored words script, i don't know why but my script isn't censoring the words properly. the censored status is 80% ~
this is my code:
#!/usr/bin/perl -w
use strict;
my @text;
my @cencoredText;
my $file = "blabla\\text.txt";
open(FH, "<", $file) or die "cant open file";
while(<FH>)
{
push(@text,$_);
}
close(FH);
my $cencoredFile = "blabla\\forbidden.txt";
open(FH2, "<", $cencoredFile) or die "cant open file";
while(<FH2>)
{
push(@cencoredText,$_);
}
close(FH2);
for(my $i=0; $i<@cencoredText; $i++)
{
for(my $j=0; $j<@text; $j++)
{
$text[$j] =~ s/${cencoredText[$i]}/censored/g;
}
}
the two files open and the perl script get the info from them.. i don't know whats wrong.. thanks!