$file=$_; while() { $file =~ /<([^>].+)>/g; die "Incorrect entry $1\n" unless grep { $_ eq $1 } @tags; }