#!/usr/bin/perl $^I = ".bak"; @ARGV = glob "*"; while (<>) { s/old/new/ and $changes = 1; print; if (eof) { # retreat if no changes: rename "$ARGV$^I", $ARGV unless $changes; $changes = 0; # reset } }
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
In reply to •Re: perlpie only on files with affected contents
by merlyn
in thread perlpie only on files with affected contents
by stabu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |