in reply to Edit a text file line by line

Try it like this instead:

#!/usr/bin/perl use warnings; use strict; @ARGV = grep !-d, <*/*>; $^I = '.bak'; while ( <> ) { print STDERR "$ARGV\n" if $. == 1; s/Manual_common_macros/test_macros/g || s/Manual_constants/test_co +nstants/g; print; close ARGV if eof; } exit 0;