#!/usr/local/bin/perl -l -w my $str=" hello there
"; my @good_tags = qw(p a font br h1 h2 h3 h4 h5 h6); my %good_tags; @good_tags{@good_tags} = (); $str =~ s!()!exists $good_tags{lc($2)} ? $1 : ''!eg; print $str;