print “Enter text”;
$input=;
chop ($input);

@replace=$input;

$linecount=0;

$count=0;

open(FILE,”<t.txt”);

$word=;

open(FILEOUT,”>t.tmp”);

@array=();

while($word ne “”)
{

@word1=split(/ / ,$word);

$length=@word1;

if($length>=5)
{
@temp=@word1;
@temp1=@temp;

splice(@temp1, 4, 1, @replace);

@final=join(” “, @temp1);

print FILEOUT @final;

}
else

{
print FILEOUT $word;
}

##

$word=;

}
close(FILE);
close(FILEOUT);

rename “t.tmp”,”t.txt”;