my $file = $_; my @tags=(qw(kt bold ital ch([^>]*))); my %allowed_tag = map { $_ => 1 } @tags; while (defined (my $line = )) { $line =~ /<([^>].+)>/; my $tag = $1; die "Invalid element $tag in $.. Cannot proceed due to the above error\n" unless exists $allowed_tag{$tag};