in reply to Re: Matching elements in a array
in thread Matching elements in a array

Actually, I just realized that if you do go this route you can avoid needing to match twice:
my @tag_regexes = map { qr/<($_) ?[^>]*>/ } qw/kt bold ital ch\d/; while (defined (my $line = <DATA>)) { die "Invalid element in line #$. ($line). Cannot proceed due to th +e above error\n" unless grep { $line =~ $_ } @tag_regexes; } __DATA__ <kt> <bold> <ital> <ch1> <kt someattribute="somevalue"> <bold someattribute="somevalue"> <ital someattribute="somevalue"> <ch1 someattribute="somevalue"> <foo>