use strict; use warnings; use File::Find; my $bak_ext = '.bak'; my $root_dir = 'C:/Temp/Chris/'; find(\&fix, $root_dir); sub fix { # if the extension fits... return if ! /\.xml?/i; print "Processing $_\n"; # set up in place edit local @ARGV = ($_); # local $^I = $bak_ext; # Edit the file while (<>) { # Edit $_ (the current line) as required here print; # Write out the new version of the line } }