This script is now doing my head in, Im getting no errors when running it and I know it is reading the file I specified it just isnt replacing the text.
Anyone have any ideas before I totally loose it.
Thanks for any help in advance
#!\perl\bin -
print 'What is your the file (complete path required) you are looking for?';
$filename= <STDIN>;
chomp ($filename);
if (open (EXAMPLE, "$filename"
)
{
print "what text would you like to replace? \n";
$search= <STDIN>;
chomp ($search);
print "what text would you like in its place? \n";
$replace= <STDIN>;
chomp ($replace);
$count = 0;
$text = <EXAMPLE>;
while ($text =~ s/$search/$replace/)
{
$count++;
$text = <EXAMPLE>;
}
print "count = $count \n";
}
else
{
print "That file does not exist\n";
}
Anyone have any ideas before I totally loose it.
Thanks for any help in advance
#!\perl\bin -
print 'What is your the file (complete path required) you are looking for?';
$filename= <STDIN>;
chomp ($filename);
if (open (EXAMPLE, "$filename"
{
print "what text would you like to replace? \n";
$search= <STDIN>;
chomp ($search);
print "what text would you like in its place? \n";
$replace= <STDIN>;
chomp ($replace);
$count = 0;
$text = <EXAMPLE>;
while ($text =~ s/$search/$replace/)
{
$count++;
$text = <EXAMPLE>;
}
print "count = $count \n";
}
else
{
print "That file does not exist\n";
}