use strict; use warnings; while (<>) { s{(<[^?<>]*\.[^<>]*>)}{ (my $tagname = $1 ) =~ tr/.//d; $tagname; }eg; print; } #### STUFF T BLAH #### STUFF T BLAH