Hi everybody, I had a plan to use "Dev C++", but my friends suggested, PERL is much more efficinet in my case.
My code has to open a directory(only text files exist on this directory). Read every text file, and looks for specific number like (E122), and replace it with something elso, or leave it blank. Then this output of each file saves in a new textfile, and new directory. Till now, I can make a directory in perl. I can see all the contents of a directory, even in the share-folder in interanet. Also I can make a copy of file to another directory with the same name, or even specific name. Please see these codes. Still I couldn't combine all code together.
CODE
...my first code it shows the content f every directory
opendir(DIRHANDLE, "C:/Users/mona&jasmin/Desktop/pclaw1");
while (defined ($filename = readdir(DIRHANDLE))){
print "Inside pclaw1 is something called $filename\n";
}
closedir(DIRHANDLE);
......My second code.....copy file to new directory
use File::Copy;
copy("C:/Users/mona&jasmin/Desktop/pclaw1/pclaw.txt","C:/Users/mona&jasmin/Desktop/test");
please help me in searching for specific nmber in a textfile in the given directory, and replacing this number with something else. I used the command below, but It doesn't work in my case.Gives error
perl -p -i -e 's/oldstring/newstring/g' *