use strict; use File::Find; use HTML::TokeParser; my $bak_ext = '.bak'; my $root_dir = 'C:/Temp/Chris'; find(\&wanted, $root_dir); sub wanted { # if the extension fits... if ( /\.xml?/i ) { print "Processing $_\n"; my $new = $_; my $bak = $_ . $bak_ext; rename $_, $bak or die "Cannot rename $_ to $bak: $!"; open NEW, "> $new" or die "Cannot open $new for writing: $!"; my $p = HTML::TokeParser->new( $bak ); while ( my $token = $p->get_token ) { my $text_index = $token->[0] eq 'T' ? 1 : -1; $token->[ $text_index ] =~ s/