That is because you are only printing the changes to the screen.  Try this:

open(IN,"fileToClean.asc");
while(<IN>){
   s/Good/Bad/;
   push @out,$_;
}
close IN;

open(OUT,">fileToClean.asc");
print OUT @out;

-----Original Message-----
From: Booher Timothy B 1stLt AFRL/MNAC
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 12, 2002 4:04 PM
To: [EMAIL PROTECTED]
Subject: windows perl just doesn't seem to work


Hello - I am very frustrated - after quite a while I can't get my ActivePerl
to work on anything in windows. Say I want to find the word Good and change
it to Bad in the file MyFile.asc
 
I try:
 
C:\changeIt.pl -e "s/Good/Bad/" MyFile.asc
 
Then open MyFile.asc and nothing happens - then I try this:
 
# this is a script to clean
 
open(IN,"fileToClean.asc") || die "can't open!";
 
while(<IN>) {
    s/Good/Bad/;
    print;
}
 
On the screen I can see that this is working, but when I open the file,
guess what? Nothing has changed! I tried a question on this same topic
awhile ago and everybody said that they got it to work in cgywin and unix
etc - I'll try again - can anybody figure out what I am doing wrong?
 
Thanks,
 
tim


--------------------------------------------------------------------------------
This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to