Hey Jose, The open file is a basic concept that should be easy to pick up. I will give you the fish, and maybe someone else will be kind enough to teach you how via perldoc (I still am lost in the internal docs)...
my $new_file; open(FILE,'<file.txt') or die "Can't open file.txt: $!\n"; while(my $line=<FILE>) { $line=~s/WORD_TO_REPLACE/REPLACEMENT_WORD/g; $new_file.=$line; } # or this after opening: # undef $/; # $new_file=<FILE>; # $/="\n"; # $new_file=~s/WORD_TO_REPLACE/REPLACEMENT_WORD/g; close(FILE); open(FILE,'>new_file.txt') or die "Can't write new_file.txt: $!\n"; print FILE $new_file; close(FILE); To delete the word from the second problem, just remove the REPLACEMENT_WORD completely (replace with nothing). Shawn ----- Original Message ----- From: "Jose Vicente" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, December 20, 2001 10:30 AM Subject: I need your help > Hi. > I am trying two items in a script: > > - I have to read a file and when I find certain word I must change it for > other one. > - I have to read a file and when I find certain word I must delete it from > the file and all the ocurrences. > > Thanks for your help. > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]