Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

replacing a scalar in a test file

Status
Not open for further replies.

jackz15

Programmer
Jun 28, 2006
103
US
hi, my new program finds some thing and stores it in the scalar $word,then i push it into an array. But after that i no longer have need for it to be in the text file so i want to delete it.
But i can't just do:
$words=~s/\$words//o;
taking the $1 value instead of $word doesnt' work either
someone help?

 
you have to edit the file, not the variable, to remove the word from the file. Can you post your code?
 
or something like:
Code:
open(READ,"test_file");
$file_contents = <READ>;
close READ;
$file_contents =~ s/$word//;
open(WRITE,">test_file");
print WRITE "$file_contents;
close WRITE;
I think that should work...

 
thanks for the replys, i didn't see this post in time though...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top