Use one-liner Perl to do the replacement without calling 'open' and '<>' and 'close' directly.
$ perl -pi.bak -e 's/abc/def/' file.txt 2007/8/24, Yoyoyo Yoyoyoyo <[EMAIL PROTECTED]>: > Hi all, > > I have a file that I need to use the substitute operator on to get rid of > spaces, and apostrophes and such. The only way I can think of doing it is > this: > > 1. Open the file and go through it one line at a time with the diamond > operator. > 2. Make the substitutions on the $_ variable and save the changes in an > array. > 3. Close the file, then re-open it and overwrite it with the array. > > I was just wondering if there was an easier or better way of doing this. For > instance, is there a way to do it that doesn't involve using the diamond > operator at all? Any help is appreciated, thanks. > > Robert > > > --------------------------------- > Ready for the edge of your seat? Check out tonight's top picks on Yahoo! TV. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/