On 10/25/07, Chas. Owens <[EMAIL PROTECTED]> wrote:
>
> From the sound of it what you want is in-place-editing:
>
> #!/usr/bin/perl -i
>
> use strict;
> use warnings;
>
> while (<>) {
> s/this/that/
> }
>
> The code above will read in any number of files modifying "this" to
> "that" in each one.
Doesn't that code empty out a file? That is, isn't there a key line
missing:
#!/usr/bin/perl -i
use strict;
use warnings;
while (<>) {
s/this/that/;
print;
}
I apologize if "print;" was so obvious that it didn't even need to be
mentioned, but to be honest, I tried it without that line and emptied a few
test files before I got it right.